0
私はプレイリストのすべてのビデオをダウンロードするプレイリストダウンローダーを作っていますが、これまでは360pでしかダウンロードできません。自動的に最高解像度のビデオを探してダウンロードしたいと思います。ここでC#ビデオで最高の利用可能なYouTube解像度を見つける
は私のコードです:
IEnumerable<VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls("www.youtube.com/watch?v=" + vid.ToString());
VideoInfo video = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);
string filename = video.Title;
if (video.RequiresDecryption)
{
DownloadUrlResolver.DecryptDownloadUrl(video);
}
string invalidChars = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
foreach (char c in invalidChars)
{
filename = filename.Replace(c.ToString(), "");
}
var videoDownloader = new VideoDownloader(video, Path.Combine(corpath, filename + video.VideoExtension));
Console.Write("\rVideo #{0} is currently being downloaded...", i.ToString());
videoDownloader.Execute();
i++;
}
catch (Exception ex)
{
}
私はこのライブラリを使用しています:videoInfosを通じてhttps://github.com/flagbug/YoutubeExtractor/