Exemple #1
0
        private List <VideoInfo> GetVideos(string url, bool checkForNext, Category category = null)
        {
            List <VideoInfo> videos = new List <VideoInfo>();
            string           data   = GetWebData(url);

            if (category != null)
            {
                currentCategoryThumb = category.Thumb;
            }
            Regex r     = new Regex(@"<h3>Watch Online:(?<n>.*?)Season (?<s>\d*)? Serie (?<e>\d*)?.*?</h3.*?(?<t><table.*?</table>)", RegexOptions.Singleline);
            Match match = r.Match(data);

            if (match.Success)
            {
                // Show page:
                string imdb = GetImdbId(data);
                uint   year = GetRelesaseYear(data);

                foreach (Match m in r.Matches(data))
                {
                    LosMoviesVideoInfo video = new LosMoviesVideoInfo()
                    {
                        Title = m.Groups["n"].Value.Trim() + " " + m.Groups["s"].Value + "x" + m.Groups["e"].Value,
                        Thumb = currentCategoryThumb
                    };
                    video.TrackingInfo = new TrackingInfo()
                    {
                        ID_IMDB   = imdb,
                        Title     = m.Groups["n"].Value.Trim(),
                        Season    = uint.Parse(m.Groups["s"].Value),
                        Episode   = uint.Parse(m.Groups["e"].Value),
                        VideoKind = VideoKind.TvSeries,
                        Year      = year
                    };
                    videos.Add(video);
                }
            }
            else
            {
                if (category != null)
                {
                    r     = new Regex(@"<tr class=""linkTr"">.*?""linkQuality[^>]*>(?<q>[^<]*)<.*?linkHiddenUrl[^>]*>(?<u>[^<]*)<.*?</tr", RegexOptions.Singleline);
                    match = r.Match(data);
                    if (match.Success)
                    {
                        //Movie page
                        LosMoviesVideoInfo video = new LosMoviesVideoInfo()
                        {
                            Title        = category.Name,
                            Thumb        = currentCategoryThumb,
                            VideoUrl     = url,
                            Description  = category.Description,
                            TrackingInfo = null
                        };
                        video.TrackingInfo = new TrackingInfo()
                        {
                            ID_IMDB   = GetImdbId(data),
                            Title     = video.Title,
                            VideoKind = VideoKind.Movie,
                            Year      = GetRelesaseYear(data)
                        };
                        videos.Add(video);
                    }
                }
                if (videos.Count == 0)
                {
                    //Movie listing
                    r = new Regex(@"<div id=""movie-.*?""movieQuality[^>]*?>(?<q>[^<]*)<.*?<a href=""(?<u>[^""]*)"".*?<img src=""(?<i>[^""]*)"".*?>(?<n>[^<]*)</h4", RegexOptions.Singleline);
                    foreach (Match m in r.Matches(data))
                    {
                        LosMoviesVideoInfo video = new LosMoviesVideoInfo()
                        {
                            Title        = m.Groups["n"].Value,
                            Thumb        = m.Groups["i"].Value,
                            VideoUrl     = baseUrl + m.Groups["u"].Value,
                            Description  = "Quality: " + m.Groups["q"].Value.Trim(),
                            TrackingInfo = new TrackingInfo()
                            {
                                Title     = m.Groups["n"].Value.Trim(),
                                VideoKind = VideoKind.Movie
                            }
                        };
                        videos.Add(video);
                    }
                }
            }
            if (checkForNext)
            {
                nextPageUrl = GetNextLink(data);
                HasNextPage = !string.IsNullOrEmpty(nextPageUrl);
            }
            return(videos);
        }
        private List<VideoInfo> GetVideos(string url, bool checkForNext, Category category = null)
        {
            List<VideoInfo> videos = new List<VideoInfo>();
            string data = GetWebData(url);
            if (category != null)
            {
                currentCategoryThumb = category.Thumb;
            }
            Regex r = new Regex(@"<h3>Watch Online:(?<n>.*?)Season (?<s>\d*)? Serie (?<e>\d*)?.*?</h3.*?(?<t><table.*?</table>)", RegexOptions.Singleline);
            Match match = r.Match(data);
            if (match.Success)
            {
                // Show page:
                string imdb = GetImdbId(data);
                uint year = GetRelesaseYear(data);

                foreach (Match m in r.Matches(data))
                {
                    LosMoviesVideoInfo video = new LosMoviesVideoInfo()
                    {
                        Title = m.Groups["n"].Value.Trim() + " " + m.Groups["s"].Value + "x" + m.Groups["e"].Value,
                        Other = m.Groups["t"].Value,
                        Thumb = currentCategoryThumb
                    };
                    video.TrackingInfo = new TrackingInfo()
                    {
                        ID_IMDB = imdb,
                        Title = m.Groups["n"].Value.Trim(),
                        Season = uint.Parse(m.Groups["s"].Value),
                        Episode = uint.Parse(m.Groups["e"].Value),
                        VideoKind = VideoKind.TvSeries,
                        Year = year
                    };
                    videos.Add(video);
                }
            }
            else
            {
                if (category != null)
                {
                    r = new Regex(@"<tr class=""linkTr"">.*?""linkQuality[^>]*>(?<q>[^<]*)<.*?linkHiddenUrl[^>]*>(?<u>[^<]*)<.*?</tr", RegexOptions.Singleline);
                    match = r.Match(data);
                    if (match.Success)
                    {
                        //Movie page
                        LosMoviesVideoInfo video = new LosMoviesVideoInfo()
                        {
                            Title = category.Name,
                            Thumb = currentCategoryThumb,
                            VideoUrl = url,
                            Description = category.Description,
                            TrackingInfo = null
                        };
                        video.TrackingInfo = new TrackingInfo()
                        {
                            ID_IMDB = GetImdbId(data),
                            Title = video.Title,
                            VideoKind = VideoKind.Movie,
                            Year = GetRelesaseYear(data)
                        };
                        videos.Add(video);
                    }
                }
                if (videos.Count == 0)
                {
                    //Movie listing
                    r = new Regex(@"<div id=""movie-.*?""movieQuality[^>]*?>(?<q>[^<]*)<.*?<a href=""(?<u>[^""]*)"".*?<img src=""(?<i>[^""]*)"".*?>(?<n>[^<]*)</h4", RegexOptions.Singleline);
                    foreach (Match m in r.Matches(data))
                    {
                        LosMoviesVideoInfo video = new LosMoviesVideoInfo()
                        {
                            Title = m.Groups["n"].Value,
                            Thumb = m.Groups["i"].Value,
                            VideoUrl = baseUrl + m.Groups["u"].Value,
                            Description = "Quality: " + m.Groups["q"].Value.Trim(),
                            TrackingInfo = null
                        };
                        videos.Add(video);
                    }
                }
            }
            if (checkForNext)
            {
                nextPageUrl = GetNextLink(data);
                HasNextPage = !string.IsNullOrEmpty(nextPageUrl);
            }
            return videos;
        }