public async static Task<List<VideoInfo>> GetVideoInfos(string videoId) { const string SHORTURL = "http://www.youtube.com/watch?v="; var videoInfos = new List<VideoInfo>(); var shortUrl = SHORTURL + videoId; var html = await GetStringAsync(new Uri(shortUrl)); var title = GetTitle(html); foreach (var url in ExtractUrls(html)) { var videoInfo = new VideoInfo(); videoInfo.VideoId = videoId; videoInfo.Title = title; videoInfo.VideoUri = new Uri(url + "&title=" + title); if (!await Task<bool>.Factory.StartNew(() => videoInfo.GetSize())) continue; videoInfo.Seconds = long.Parse( Regex.Match(html, "\"length_seconds\":(.+?),", RegexOptions.Singleline).Groups[1].ToString()); if (videoInfo.SetExtensionAndSize(html.IsWideScreen())) { if (!videoInfo.Extension.StartsWith("itag-")) videoInfos.Add(videoInfo); } } videoInfos.Sort(); return videoInfos; }