c# - 在 C# 中使用 libvideo 下载的代理

标签 c# proxy youtube youtube-dl

有谁熟悉libvideo ?我有 [libvideo][1]在一个应用程序中。

如何将代理配置注入(inject) libvideo ?

using VideoLibrary;

void SaveVideoToDisk(string link)
{
    var youTube = YouTube.Default; // starting point for YouTube actions
    var video = youTube.GetVideo(link); // gets a Video object with info about the video
    File.WriteAllBytes(@"C:\" + video.FullName, video.GetBytes());
}

最佳答案

看来libvideo不支持代理。所以我必须使用youtube-dl并更正了上面的代码

public static void YouTubeDownloaderWithProxy(string link, string path)
{
    Process youTube = new Process();
    try
    {
        string code = link.Split('/').LastOrDefault();
        string proxy = @"http://....:8585/";
        string youtubeUrl = @"https://www.youtube.com/watch?v=" + "code";

        youTube.StartInfo.UseShellExecute = true;
        youTube.StartInfo.CreateNoWindow = false;
        youTube.StartInfo.FileName = Application.StartupPath + @"\youtube-dl.exe";
        youTube.StartInfo.Arguments = $"--proxy {proxy} -o '{path}' {youtubeUrl}";

        youTube.Start();
        youTube.WaitForExit();
        youTube.Dispose();
    }
    catch (Exception e)
    {
        MessageBox.Show(e.Message);
    }

}

关于c# - 在 C# 中使用 libvideo 下载的代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56627829/

相关文章:

c# - 如何链接到 ASP.NET MVC 中的可下载文件?

proxy - 处理 https 的 Apache 转发代理

vue.js - 如何在生产中代理 Vue.js 中的 URL 调用?

api - 如何在 ext js4 中动态更改代理 api?

youtube - 带有位置参数的Youtube API 3.0搜索列表不起作用

c# - Google 数据登录到 YouTube?

c# - X-UA-Compatible 在 C# WebBrowser 控件中不起作用

c# - Enterprise Library Unity 和数据访问 block

c# - 这里提供所需信息量的最简单的数据结构是什么?

youtube - 获取给定 channel ID的YouTube用户名