Ejemplo n.º 1
0
        private void Callback(PostItem postItem)
        {
            string hTML = postItem.Post.HTML;
            List <YouTubeVideoQuality> youTubeVideoUrls = YouTubeDownloader.GetYouTubeVideoUrls(hTML);

            if (youTubeVideoUrls.Count == 0)
            {
                Thread.Sleep(1000);
                youTubeVideoUrls = YouTubeDownloader.GetYouTubeVideoUrls(hTML);
            }
            if (youTubeVideoUrls.Count > 0)
            {
                int num = 0;
                num = 0;
                while (num < youTubeVideoUrls.Count && !youTubeVideoUrls[num].Extention.Equals("mp4"))
                {
                    num++;
                }
                PostItemVideo postItemVideo = new PostItemVideo(postItem.Post, youTubeVideoUrls[num].DownloadUrl);
                Post          post          = postItem.Post;
                post.Name = string.Concat(post.Name, ".", youTubeVideoUrls[num].Extention);
                postItem.Post.Items.Add(postItemVideo);
                this.AddToDownloadQueue(postItem.Post);
            }
        }