GetDownloadUrls() public static method

Gets a list of VideoInfos for the specified URL.
/// The parameter is null. /// /// The parameter is not a valid YouTube URL. /// The video is not available. /// An error occurred while downloading the YouTube page html. /// The Youtube page could not be parsed.
public static GetDownloadUrls ( string videoUrl, bool decryptSignature = true ) : IEnumerable
videoUrl string The URL of the YouTube video.
decryptSignature bool /// A value indicating whether the video signatures should be decrypted or not. Decrypting /// consists of a HTTP request for each , so you may want to set /// this to false and call on your selected later. ///
return IEnumerable
示例#1
0
        static void Main(string[] args)
        {
            try
            {
                //var link = new List<string>();
                //link.Add("https://www.youtube.com/watch?v=GlGuLcQhrWg");
                string link = @"https://www.youtube.com/watch?v=YzC-FYg66xA&list=PL0kIvpOlieSNWR3YPSjh9P2p43SFnNBlB&index=1";
                //foreach (var item in link)
                //{

                IEnumerable <VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls("https://www.youtube.com/watch?v=YzC-FYg66xA&list=PL0kIvpOlieSNWR3YPSjh9P2p43SFnNBlB&index=1");
                VideoInfo video           = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 720);
                var       videoDownloader = new VideoDownloader(video, Path.Combine(@"C:\Users\lalomarquez\Desktop\", video.Title + video.VideoExtension));

                videoDownloader.DownloadProgressChanged += (sender, argss) => Console.WriteLine(argss.ProgressPercentage);
                videoDownloader.Execute();
                //}
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
 public static Task <IEnumerable <VideoInfo> > GetDownloadUrlsAsync(string videoUrl, bool decryptSignature = true)
 {
     return(Task.Run <IEnumerable <VideoInfo> >(() => DownloadUrlResolver.GetDownloadUrls(videoUrl, decryptSignature)));
 }