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=" + "mVFMA35PFcw";
youTube.StartInfo.UseShellExecute = true;
youTube.StartInfo.CreateNoWindow = false;
youTube.StartInfo.FileName = Application.StartupPath + @"\youtube-dl.exe";
//youTube.StartInfo.Arguments = $"--proxy {proxy} -f '[ext=mp4]+bestvideo[height<=720]' -o {path} {youtubeUrl}";
youTube.StartInfo.Arguments = $"--proxy {proxy} -o '{path}' {youtubeUrl}";
youTube.Start();
youTube.WaitForExit();
youTube.Dispose();
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}`
我编写了一个函数,它从youtube下载了文件。 我的问题是CMD打开并在一段时间后Visual Studio中开始下载时显示此错误:
(RPC_E_SYS_CALL_FAILED)). This is typically because the COM context 0xbc3201a8 where this RuntimeCallableWrapper was created has been disconnected or it is busy doing something else. Releasing the interfaces from the current COM context (COM context 0xbc3202d0). This may cause corruption or data loss. To avoid this problem, please ensure that all COM contexts/apartments/threads stay alive and are available for context transition, until the application is completely done with the RuntimeCallableWrappers that represents COM components that live inside them.'
我使用youtube-dl