Exemplo n.º 1
0
        public async Task <IReadOnlyList <CopyrightNotice> > GetCopyrightNotices(string channelId)
        {
            var notices = new List <CopyrightNotice>();

            using (var browser = new ChromeBrowser())
            {
                var parser           = new CopyrightNoticesParser();
                var videosPageSource = browser.GetPageSource("https://www.youtube.com/my_videos_copyright");
                var videoUrls        = await parser.ParseVideosCopyright(videosPageSource);

                foreach (var videoUrl in videoUrls)
                {
                    var pageSource       = browser.GetPageSource($"https://www.youtube.com/{videoUrl}");
                    var videoId          = videoUrl.Replace("/video_copynotice?v=", string.Empty);
                    var copyrightNotices = await parser.ParseCopyrightNotices(videoId, pageSource);

                    if (copyrightNotices != null && copyrightNotices.Any())
                    {
                        notices.AddRange(copyrightNotices);
                    }
                }
            }

            return(notices);
        }