public override List <SearchResultItem> Search(string query, string category = null) { pageNr = 1; baseVideoListUrl = string.Format(searchUrl, query); currenttype = UgType.None; return(lowGetVideoList(baseVideoListUrl, currenttype).ConvertAll <SearchResultItem>(v => v as SearchResultItem)); }
public override List <VideoInfo> GetVideos(Category category) { pageNr = 1; baseVideoListUrl = ((RssLink)category).Url; currenttype = (UgType)category.Other; return(lowGetVideoList(baseVideoListUrl, currenttype)); }
private int getSubcats(Category parentCat, UgType subType, string id, string format) { HtmlDocument data = GetWebData <HtmlDocument>(((RssLink)parentCat).Url, cookies: GetCookie(), forceUTF8: true); var node = data.DocumentNode.Descendants("select").Where(sel => sel.GetAttributeValue("id", "") == id).FirstOrDefault(); var options = node.Descendants("option").Where(option => option.GetAttributeValue("disabled", "") != "disabled"); parentCat.SubCategories = new List <Category>(); foreach (var option in options) { parentCat.SubCategories.Add(new RssLink() { Name = option.NextSibling.InnerText, Url = String.Format(format, option.GetAttributeValue("value", "")), HasSubCategories = subType != UgType.None, Other = subType, ParentCategory = parentCat }); } parentCat.SubCategoriesDiscovered = true; return(parentCat.SubCategories.Count); }
private List <VideoInfo> lowGetVideoList(string url, UgType type) { string data = GetWebData(url, cookies: GetCookie(), forceUTF8: true); List <VideoInfo> res = base.Parse(url, data); foreach (VideoInfo video in res) { int p = video.Airdate.LastIndexOf('·'); if (p >= 0) { video.Length = video.Airdate.Substring(p + 1).Trim(); video.Airdate = video.Airdate.Substring(0, p).Trim(); } } pageNr++; if (type == UgType.None) { nextPageAvailable = true; nextPageUrl = baseVideoListUrl + "&page=" + pageNr.ToString(); } if (type == UgType.Series) { nextPageAvailable = res.Count >= 8 && data.Contains(@"<span>Meer afleveringen</span>"); if (nextPageAvailable) { nextPageUrl = baseVideoListUrl + "/search?media_type=broadcast&start_date=&end_date=&start=" + (pageNr * 8 - 8).ToString() + "&rows=8"; } else { nextPageUrl = String.Empty; } } return(res); }
public override List<SearchResultItem> Search(string query, string category = null) { pageNr = 1; baseVideoListUrl = string.Format(searchUrl, query); currenttype = UgType.None; return lowGetVideoList(baseVideoListUrl, currenttype).ConvertAll<SearchResultItem>(v => v as SearchResultItem); }
private List<VideoInfo> lowGetVideoList(string url, UgType type) { string data = GetWebData(url, cookies: GetCookie(), forceUTF8: true); List<VideoInfo> res = base.Parse(url, data); foreach (VideoInfo video in res) { int p = video.Airdate.LastIndexOf('·'); if (p >= 0) { video.Length = video.Airdate.Substring(p + 1).Trim(); video.Airdate = video.Airdate.Substring(0, p).Trim(); } } pageNr++; if (type == UgType.None) { nextPageAvailable = true; nextPageUrl = baseVideoListUrl + "&page=" + pageNr.ToString(); } if (type == UgType.Series) { nextPageAvailable = res.Count >= 8 && data.Contains(@"<span>Meer afleveringen</span>"); if (nextPageAvailable) nextPageUrl = baseVideoListUrl + "/search?media_type=broadcast&start_date=&end_date=&start=" + (pageNr * 8 - 8).ToString() + "&rows=8"; else nextPageUrl = String.Empty; } return res; }
public override List<VideoInfo> GetVideos(Category category) { pageNr = 1; baseVideoListUrl = ((RssLink)category).Url; currenttype = (UgType)category.Other; return lowGetVideoList(baseVideoListUrl, currenttype); }
private int getSubcats(Category parentCat, UgType subType, string id, string format) { HtmlDocument data = GetWebData<HtmlDocument>(((RssLink)parentCat).Url, cookies: GetCookie(), forceUTF8: true); var node = data.DocumentNode.Descendants("select").Where(sel => sel.GetAttributeValue("id", "") == id).FirstOrDefault(); var options = node.Descendants("option").Where(option => option.GetAttributeValue("disabled", "") != "disabled"); parentCat.SubCategories = new List<Category>(); foreach (var option in options) { parentCat.SubCategories.Add(new RssLink() { Name = option.NextSibling.InnerText, Url = String.Format(format, option.GetAttributeValue("value", "")), HasSubCategories = subType != UgType.None, Other = subType, ParentCategory = parentCat }); } parentCat.SubCategoriesDiscovered = true; return parentCat.SubCategories.Count; }