public static void AddToDb(WebVid webVid)
        {
            using (var db = new PerpetualShredContext())
            {
                if ((webVid.Title == null) || (webVid.Synopsis == null) || (webVid.Title == "") || (webVid.Synopsis == ""))
                {
                    return;
                }

                if (db.WebVid.Any(o => o.PlayerUrl == webVid.PlayerUrl))
                {
                    Console.WriteLine("Duplicate found : " + webVid.Title);
                }

                else
                {
                    db.Add(webVid);
                    db.SaveChanges();
                    Console.WriteLine(@"Origin Url: " + webVid.OriginUrl);
                    Console.WriteLine(@"Origin Title: " + webVid.OriginTitle);
                    Console.WriteLine(@"Player Url: " + webVid.PlayerUrl);
                    Console.WriteLine($@"Title: ""{webVid.Title}""");
                    Console.WriteLine(@"Synopsis: " + webVid.Synopsis);
                    Console.WriteLine(@"Release Date: " + webVid.ReleaseDate);
                    Console.WriteLine();
                }
            }
        }
        public IEnumerable <WebVid> Collect(HtmlDocument htmlDoc)
        {
            var vimeoMatch = new Regex("(player.)?(vimeo.com)/(video/)?([0-9]+)");

            var vmVidList = new List <WebVid>();
            var vmNodes   = htmlDoc.DocumentNode.SelectNodes("//iframe");

            if (vmNodes == null)
            {
                return(new List <WebVid>());
            }

            foreach (var node in vmNodes)
            {
                var vimeoMatches = vimeoMatch.Match(node.OuterHtml);

                if (!vimeoMatches.Success)
                {
                    continue;
                }
                var vmVidToAdd = new WebVid();

                var input = vimeoMatches.Value;

                var vmId = input.Substring(23, input.Length - 23);

                Console.WriteLine(@"Vimeo match: " + input);

                var tempVid = RetrieveData(vmId);

                vmVidToAdd.Title        = tempVid.Title;
                vmVidToAdd.ReleaseDate  = Convert.ToDateTime(tempVid.UploadDate);
                vmVidToAdd.Synopsis     = tempVid.Description;
                vmVidToAdd.PlayerUrl    = "https://" + input + "?autoplay=1";
                vmVidToAdd.OriginUrl    = "http://www.vimeo.com/" + tempVid.UserId;
                vmVidToAdd.OriginTitle  = tempVid.UserName + " on Vimeo";
                vmVidToAdd.VideoService = "Vimeo";
                vmVidToAdd.Thumbnail    = tempVid.ThumbnailSmall;
                vmVidList.Add(vmVidToAdd);
            }

            return(vmVidList);
        }
        public IEnumerable <WebVid> Collect(HtmlDocument htmlDoc)
        {
            var youtubeMatch = new Regex("youtu(?:.be|be.com)/(?:.*v(?:/|=)|(?:.*/)?)([a-zA-Z0-9-_]).+?(?=\")");
            var ytVidList    = new List <WebVid>();
            var ytNodes      = htmlDoc.DocumentNode.SelectNodes("//iframe");

            if (ytNodes == null)
            {
                return(new List <WebVid>());
            }

            foreach (var node in ytNodes)
            {
                var youtubeMatches = youtubeMatch.Match(node.OuterHtml);

                if (!youtubeMatches.Success)
                {
                    continue;
                }
                var ytVidToAdd = new WebVid();

                var input = youtubeMatches.Value;
                var ytId  = input.Substring(18, 11);

                var tempVid = RetrieveData(ytId);

                Console.WriteLine(@"Youtube match: " + input);

                ytVidToAdd.Title        = tempVid.Title;
                ytVidToAdd.ReleaseDate  = tempVid.ReleaseDate;
                ytVidToAdd.Synopsis     = tempVid.Synopsis;
                ytVidToAdd.PlayerUrl    = "http://www." + input + "?&theme=dark&autoplay=1&autohide=1&modestbranding=1&fs=0&showinfo=0&rel=0";
                ytVidToAdd.OriginUrl    = "http://www.youtube.com/channel/" + tempVid.ChannelId;
                ytVidToAdd.OriginTitle  = tempVid.ChannelTitle + " on YouTube";
                ytVidToAdd.VideoService = "YouTube";
                ytVidToAdd.Thumbnail    = tempVid.Thumbnail;
                ytVidList.Add(ytVidToAdd);
            }

            return(ytVidList);
        }