public override int DiscoverDynamicCategories() { if (Settings.Categories == null) Settings.Categories = new BindingList<Category>(); cc = new CookieContainer(); string data = GetWebData(@"https://www.filmon.com/tv/live", userAgent: userAgent, cookies: cc); string jsondata = @"{""result"":" + Helpers.StringUtils.GetSubString(data, "var groups =", @"if(!$.isArray").Trim().TrimEnd(';') + "}"; JToken jt = JObject.Parse(jsondata) as JToken; foreach (JToken jCat in jt["result"] as JArray) { RssLink cat = new RssLink(); cat.Name = jCat.Value<string>("title"); cat.Description = jCat.Value<string>("description"); cat.Thumb = jCat.Value<string>("logo_uri"); Settings.Categories.Add(cat); JArray channels = jCat["channels"] as JArray; List<VideoInfo> videos = new List<VideoInfo>(); foreach (JToken channel in channels) { VideoInfo video = new VideoInfo(); video.Thumb = channel.Value<string>("logo"); video.Description = channel.Value<string>("description"); video.Title = channel.Value<string>("title"); video.VideoUrl = @"https://www.filmon.com/ajax/getChannelInfo"; video.Other = String.Format(@"channel_id={0}&quality=low", channel.Value<string>("id")); videos.Add(video); } cat.Other = videos; } Settings.DynamicCategoriesDiscovered = true; return Settings.Categories.Count; }
public override int DiscoverSubCategories(Category parentCategory) { List<Category> cats = new List<Category>(); Regex reg; string url; if ((parentCategory as RssLink).Url.EndsWith("topshows")) { reg = new Regex(@"<li[^>]*>\s*<a href=""([^""]*)"">\s*<span[^>]*>\s*<span[^>]*>[^>]*>\s*<span[^>]*>\s*<span[^>]*>[^>]*>\s*<img.*? src=""([^""]*)""[^>]*>\s*<span[^>]*>\s*<span[^>]*>Full episodes</span>(.|\s)*?<em>([^<]*)</em>"); url = "http://www.channel5.com/shows"; } else { reg = new Regex(@"<a href=""([^""]*)"" class=""clearfix"">\s*<span[^>]*>\s*<span[^>]*>[^<]*</span>\s*<img.*? src=""([^""]*)""[^>]*>\s*<span[^>]*>\s*<span[^>]*>Full episode</span>(.|\s)*?<em>([^<]*)</em>"); url = (parentCategory as RssLink).Url; } string html = GetWebData(url); foreach (Match m in reg.Matches(html)) { RssLink cat = new RssLink(); cat.Url = BASE_URL + m.Groups[1].Value; cat.Thumb = m.Groups[2].Value; cat.Name = cleanString(m.Groups[4].Value); cat.ParentCategory = parentCategory; cats.Add(cat); } parentCategory.SubCategories = cats; parentCategory.SubCategoriesDiscovered = true; return cats.Count; }
public override int ParseSubCategories(Category parentCategory, string data) { List<Category> dynamicSubCategories = new List<Category>(); // put all new discovered Categories in a separate list JObject jsonData = GetWebData<JObject>((parentCategory as RssLink).Url); Log.Debug("Number of items: " + jsonData["meta"].Value<string>("nr_of_items_total")); if (jsonData != null) { foreach (JToken item in jsonData["abstracts"]) { RssLink cat = new RssLink(); cat.Url = String.Format("http://www.rtl.nl/system/s4m/vfd/version=2/fun=abstract/d=a3t/fmt=progressive/ak={0}/output=json/pg=1/", item.Value<string>("key")); cat.Name = item.Value<string>("name"); cat.Thumb = jsonData["meta"].Value<string>("poster_base_url") + item.Value<string>("coverurl"); cat.Description = item.Value<string>("synopsis"); cat.ParentCategory = parentCategory; dynamicSubCategories.Add(cat); } // discovery finished, copy them to the actual list -> prevents double entries if error occurs in the middle of adding if (parentCategory.SubCategories == null) parentCategory.SubCategories = new List<Category>(); foreach (Category cat in dynamicSubCategories) parentCategory.SubCategories.Add(cat); parentCategory.SubCategoriesDiscovered = dynamicSubCategories.Count > 0; // only set to true if actually discovered (forces re-discovery until found) } return parentCategory.SubCategories == null ? 0 : parentCategory.SubCategories.Count; }
public override int DiscoverDynamicCategories() { Settings.Categories.Add(new RssLink() { Name = "Sendungen A-Z", HasSubCategories = true, Url = "http://www.ardmediathek.de/tv/sendungen-a-z" }); Settings.Categories.Add(new RssLink() { Name = "Sendung verpasst?", HasSubCategories = true, Url = "http://www.ardmediathek.de/tv/sendungVerpasst" }); Settings.Categories.Add(new RssLink() { Name = "TV-Livestreams", Url = "http://www.ardmediathek.de/tv/live" }); Uri baseUri = new Uri("http://www.ardmediathek.de/tv"); var baseDoc = GetWebData<HtmlDocument>(baseUri.AbsoluteUri); foreach (var modHeadline in baseDoc.DocumentNode.Descendants("h2").Where(h2 => h2.GetAttributeValue("class", "") == "modHeadline")) { var title = HttpUtility.HtmlDecode(string.Join("", modHeadline.Elements("#text").Select(t => t.InnerText.Trim()).ToArray())); if (!title.ToLower().Contains("live")) { var moreLink = modHeadline.ParentNode.Descendants("a").FirstOrDefault(a => a.GetAttributeValue("class", "") == "more"); if (moreLink != null) { Settings.Categories.Add(new RssLink() { Name = title, Url = new Uri(baseUri, moreLink.GetAttributeValue("href", "")).AbsoluteUri, HasSubCategories = !SubItemsAreVideos(modHeadline.ParentNode) }); } else { var cat = new RssLink() { Name = title, Url = baseUri.AbsoluteUri, HasSubCategories = true, SubCategoriesDiscovered = true, SubCategories = new List<Category>() }; GetSubcategoriesFromDiv(cat, modHeadline.ParentNode); Settings.Categories.Add(cat); } } } Settings.DynamicCategoriesDiscovered = true; return Settings.Categories.Count; }
public override List <VideoInfo> GetVideos(Category category) { RssLink parentCategory = category as RssLink; List <VideoInfo> videoList = new List <VideoInfo>(); String data = GetWebData(parentCategory.Url); //JObject jsonCapitulos = JObject.Parse("{\"a\":" + data + "}"); JObject jsonCapitulos = JObject.Parse(data); JArray capitulos = (JArray)jsonCapitulos["1"]; for (int k = 0; k < capitulos.Count; k++) { JToken capitulo = capitulos[k]; String tipo = (String)capitulo.SelectToken("icono"); if (tipo.Equals("preestreno")) { tipo = PREESTRENO; } else if (tipo.Equals("user")) { tipo = REGISTRO; } else if (tipo.Equals("premium")) { tipo = PREMIUM; } VideoInfo video = new VideoInfo(); video.Title = (String)capitulo.SelectToken("title") + (tipo.Equals("") ? "" : " - " + tipo); video.VideoUrl = (String)capitulo.SelectToken("hrefHtml"); video.Thumb = baseUrl + (String)capitulo.SelectToken("srcImage"); video.Description = tipo; video.Other = tipo; videoList.Add(video); } return(videoList); }
public override int DiscoverDynamicCategories() { NameValueCollection nvc = new NameValueCollection(); nvc.Add("Accept-Language", "sv-SE,sv;q=0.8,en-US;q=0.6,en;q=0.4"); JObject objects = JObject.Parse(GetWebData <string>(showsUrl, headers: nvc)); JArray items = (JArray)objects["results"]; foreach (JToken item in items) { RssLink show = new RssLink(); show.Name = (item["name"] == null) ? "" : item["name"].Value <string>(); show.Url = (item["nid"] == null) ? "" : item["nid"].Value <string>(); show.Description = (item["description"] == null) ? "" : item["description"].Value <string>(); show.Thumb = (item["program_image"] == null) ? "" : item["program_image"].Value <string>(); show.SubCategories = new List <Category>(); show.HasSubCategories = true; show.Other = (Func <List <Category> >)(() => GetShow(show)); Settings.Categories.Add(show); } Settings.DynamicCategoriesDiscovered = Settings.Categories.Count > 0; return(Settings.Categories.Count); }
public override int DiscoverDynamicCategories() { string response = GetWebData(contentHost + startUrl + "&m=mainInfo"); XmlDocument doc = new XmlDocument(); doc.LoadXml(response); foreach (XmlNode node in doc.SelectNodes("//mainInfo/categories/row")) { string type = node.SelectSingleNode("type").InnerText; string id = node.SelectSingleNode("id").InnerText; string name = getXmlValue(node, "name"); string urlQuery = String.Format("&type={0}&id={1}&limit={2}&page={{0}}&sort=newest&m=getItems", type, id, pageSize); RssLink cat = new RssLink() { Name = name, Other = node, Thumb = GetIcon(node), Url = contentHost + startUrl + urlQuery, HasSubCategories = (type == "catalog") }; Settings.Categories.Add(cat); } Settings.DynamicCategoriesDiscovered = true; return Settings.Categories.Count; }
public override int DiscoverDynamicCategories() { Settings.Categories.Clear(); string webData = GetWebData(feedPIDUrl); if (!string.IsNullOrEmpty(webData)) { Match match = feedPIDRegex.Match(webData); if (match.Success) { feedPID = match.Groups["feedPID"].Value; Log.Debug(@"Feed PID: {0}", feedPID); } } foreach (DictionaryEntry channel in localChannels) { Log.Debug(@"{0}: {1}", channel.Key, channel.Value); RssLink cat = new RssLink() { Name = (string) channel.Key, Other = (string) channel.Value, HasSubCategories = true }; Settings.Categories.Add(cat); } Settings.DynamicCategoriesDiscovered = true; return Settings.Categories.Count; }
public override int DiscoverDynamicCategories() { string data = GetWebData(baseUrl); int p = data.IndexOf('{'); int q = data.LastIndexOf('}'); data = data.Substring(p, q - p + 1); JToken alldata = JObject.Parse(data) as JToken; JArray jCats = alldata["widget"]["carousel"] as JArray; foreach (JToken jcat in jCats) { string tab = @"{""bla"":" + jcat["tab"].Value<string>() + '}'; JToken jsubcats = JObject.Parse(tab)["bla"] as JArray; foreach (JToken jsub in jsubcats) { RssLink cat = new RssLink(); cat.Name = jsub["tabTitle"].Value<string>(); cat.Url = FormatDecodeAbsolutifyUrl(baseUrl, jsub["tabTargetLevel"].Value<string>(), dynamicCategoryUrlFormatString, dynamicCategoryUrlDecoding); Settings.Categories.Add(cat); } } Settings.DynamicCategoriesDiscovered = true; return Settings.Categories.Count; }
public override int DiscoverSubCategories(Category parentCategory) { baseUrl = string.Format(@"http://{0}", ((RssLink) parentCategory).Url); parentCategory.SubCategories = new List<Category>(); string webData = GetWebData(string.Format(@"{0}/video", baseUrl)); if (!string.IsNullOrEmpty(webData)) { foreach (Match m in subCategoriesRegex.Matches(webData)) { string binId = m.Groups["binId"].Value; RssLink cat = new RssLink() { ParentCategory = parentCategory, Name = m.Groups["title"].Value, Url = string.Format(videoListUrlFormat, baseUrl, binId, "1"), HasSubCategories = false }; parentCategory.SubCategories.Add(cat); } } parentCategory.SubCategoriesDiscovered = true; return parentCategory.SubCategories.Count; }
public override int DiscoverDynamicCategories() { Settings.Categories.Clear(); HtmlDocument html = GetWebData<HtmlDocument>(baseUrl); string currentParentTitle = string.Empty; if (html != null) { foreach (HtmlNode div in html.DocumentNode.SelectNodes(mainCategoryXpath)) { HtmlNode h2 = div.SelectSingleNode(@"./h2[@class = 'sh1']"); HtmlNode anchor = div.SelectSingleNode(@"./a"); RssLink category = new RssLink() { Name = h2.InnerText, Url = string.Format(videoListUrlFormat, anchor.GetAttributeValue("rel", ""), "1"), Other = anchor.GetAttributeValue("rel", ""), HasSubCategories = false }; Settings.Categories.Add(category); } } return Settings.Categories.Count; }
public override int DiscoverDynamicCategories() { RssLink cat = new RssLink(); cat.Url = "http://www.allocine.fr/video/bandes-annonces/"; cat.Name = "Bandes-annonces"; cat.HasSubCategories = true; Settings.Categories.Add(cat); cat = new RssLink(); cat.Url = "http://www.allocine.fr/video/emissions/"; cat.Name = "Emissions Allociné"; cat.HasSubCategories = true; Settings.Categories.Add(cat); cat = new RssLink(); cat.Url = "http://www.allocine.fr/video/series/"; cat.Name = "Vidéos de séries TV"; cat.HasSubCategories = false; Settings.Categories.Add(cat); cat = new RssLink(); cat.Url = "http://www.allocine.fr/video/interviews/"; cat.Name = "Interviews de stars"; cat.HasSubCategories = false; Settings.Categories.Add(cat); Settings.DynamicCategoriesDiscovered = true; return 4; }
public override int DiscoverDynamicCategories() { List<Category> dynamicCategories = new List<Category>(); // put all new discovered Categories in a separate list JObject jsonData = GetWebData<JObject>(baseUrl); if (jsonData != null) { JToken shows = jsonData["result"]["shows"]; foreach (JToken show in shows) { RssLink cat = new RssLink(); cat.Url = show.Value<string>("canonicalURL"); cat.Name = show.Value<string>("title"); cat.Thumb = String.Format("{0}?quality=0.85&width=400&height=400&crop=true", show["images"][0].Value<string>("url")); if (!String.IsNullOrEmpty(cat.Thumb) && !Uri.IsWellFormedUriString(cat.Thumb, System.UriKind.Absolute)) cat.Thumb = new Uri(new Uri(baseUrl), cat.Thumb).AbsoluteUri; cat.Description = show.Value<string>("description"); cat.HasSubCategories = false; cat.Other = (string)show.Value<string>("id"); dynamicCategories.Add(cat); } // discovery finished, copy them to the actual list -> prevents double entries if error occurs in the middle of adding if (Settings.Categories == null) Settings.Categories = new BindingList<Category>(); foreach (Category cat in dynamicCategories) Settings.Categories.Add(cat); Settings.DynamicCategoriesDiscovered = dynamicCategories.Count > 0; // only set to true if actually discovered (forces re-discovery until found) } return dynamicCategories.Count; }
public override int DiscoverDynamicCategories() { string webData = GetWebData(@"http://tvnz.co.nz/content/ps3_navigation/ps3_xml_skin.xml"); if (!string.IsNullOrEmpty(webData)) { List<Category> dynamicCategories = new List<Category>(); // put all new discovered Categories in a separate list XmlDocument doc = new XmlDocument(); doc.LoadXml(webData); XmlNodeList cats = doc.SelectNodes(@"Menu/MenuItem[@type=""shows"" or @type=""alphabetical""]"); foreach (XmlNode node in cats) { RssLink cat = new RssLink(); cat.Url = baseUrl + node.Attributes["href"].Value; cat.Name = node.Attributes["title"].Value; cat.HasSubCategories = node.Attributes["type"].Value != "shows"; dynamicCategories.Add(cat); } // discovery finished, copy them to the actual list -> prevents double entries if error occurs in the middle of adding Settings.Categories = new BindingList<Category>(); foreach (Category cat in dynamicCategories) Settings.Categories.Add(cat); Settings.DynamicCategoriesDiscovered = true; return dynamicCategories.Count; // return the number of discovered categories } return 0; }
public override int DiscoverDynamicCategories() { Settings.Categories.Clear(); string webData = GetWebData(baseUrl); if (!string.IsNullOrEmpty(webData)) { foreach (Match m in regEx_dynamicCategories.Matches(webData)) { RssLink cat = new RssLink() { Name = HttpUtility.HtmlDecode(m.Groups["title"].Value), Url = m.Groups["url"].Value, Thumb = m.Groups["thumb"].Value, Description = HttpUtility.HtmlDecode(m.Groups["description"].Value), HasSubCategories = true }; Settings.Categories.Add(cat); } } Settings.DynamicCategoriesDiscovered = true; return Settings.Categories.Count; }
public override int DiscoverDynamicCategories() { Dictionary<string, string> teamLogos = GetTeamLogoUrls(); string js = GetWebData("http://i.cdn.turner.com/nba/nba/z/.e/js/pkg/video/901.js"); string json = Regex.Match(js, @"var\snbaChannelConfig=(?<json>[^\;]+)").Groups["json"].Value; List<Category> categories = new List<Category>(); foreach (var jsonToken in Newtonsoft.Json.Linq.JObject.Parse(json)) { string name = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(jsonToken.Key.Replace("/", ": ")); Category mainCategory = new Category() { Name = name, HasSubCategories = true, SubCategoriesDiscovered = true, SubCategories = new List<Category>() }; SetLogoAndName(teamLogos, mainCategory, jsonToken.Value as Newtonsoft.Json.Linq.JArray); foreach (var subJo in jsonToken.Value) { RssLink subCategory = new RssLink() { Name = subJo.Value<string>("display"), ParentCategory = mainCategory, Url = subJo.Value<string>("search_string") }; mainCategory.SubCategories.Add(subCategory); } categories.Add(mainCategory); categories.Sort(); Settings.Categories.Clear(); foreach (Category cat in categories) Settings.Categories.Add(cat); } Settings.DynamicCategoriesDiscovered = true; return Settings.Categories.Count; }
public override int DiscoverDynamicCategories() { RssLink filmer = new RssLink() { Name = "Filmer", Url = baseUrl }; Settings.Categories.Add(filmer); HtmlDocument doc = GetWebData<HtmlDocument>(baseUrl); HtmlNode moviehome = doc.DocumentNode.SelectSingleNode("//div[@id = 'moviehome']"); HtmlNode categorias = moviehome.SelectSingleNode("div[@class = 'categorias']"); Category kategorier = new RssLink() { Name = "Kategorier", HasSubCategories = true, SubCategories = new List<Category>(), SubCategoriesDiscovered = true }; foreach (HtmlNode item in categorias.SelectNodes(".//li")) { HtmlNode a = item.SelectSingleNode("a"); kategorier.SubCategories.Add(new RssLink() { ParentCategory = kategorier, Name = a.InnerText.Trim(), Url = a.GetAttributeValue("href", "") }); } Settings.Categories.Add(kategorier); HtmlNode filtroy = moviehome.SelectSingleNode("div[@class = 'filtro_y']"); Category ar = new RssLink() { Name = "År", HasSubCategories = true, SubCategories = new List<Category>(), SubCategoriesDiscovered = true }; foreach (HtmlNode item in filtroy.SelectNodes(".//li")) { HtmlNode a = item.SelectSingleNode("a"); ar.SubCategories.Add(new RssLink() { ParentCategory = ar, Name = a.InnerText.Trim(), Url = a.GetAttributeValue("href", "") }); } Settings.Categories.Add(ar); Settings.DynamicCategoriesDiscovered = true; return 3; }
private List <Category> GetCategories(string webData, string parent) { List <Category> tReturn = new List <Category>(); string pattern = "{\"id\":(?<id>[\\w]*),\"parentId\":" + parent + ",\"name\":\"(?<name>[\\w \\\\+\\/]*)\",\"childsCount\":(?<childs>[0-9]*)"; Regex rgx = new Regex(pattern); var tmactchs = rgx.Matches(webData); foreach (Match item in tmactchs) { RssLink cat = new RssLink(); cat.Url = item.Groups["id"].Value; cat.Name = item.Groups["name"].Value.Replace("\\u00e9", "é").Replace("\\u00e8", "è"); cat.Other = "folder"; string haschild = item.Groups["childs"].Value; int childs = 0; int.TryParse(haschild, out childs); if (childs == 0) { cat.Other = "catalog"; } cat.HasSubCategories = true; tReturn.Add(cat); } return(tReturn); }
public override int DiscoverSubCategories(Category parentCategory) { string webData = "{items:" + GetWebData(((RssLink)parentCategory).Url) + '}'; JObject contentData = (JObject)JObject.Parse(webData); parentCategory.SubCategories = new List<Category>(); if (contentData != null) { JArray items = contentData["items"] as JArray; if (items != null) { foreach (JToken item in items) { RssLink subcat = new RssLink(); subcat.Name = item.Value<string>("b"); subcat.Description = item.Value<string>("c"); subcat.Thumb = item.Value<string>("d"); subcat.Other = item["f"]; subcat.ParentCategory = parentCategory; parentCategory.SubCategories.Add(subcat); } } } parentCategory.SubCategories.Sort(); parentCategory.SubCategoriesDiscovered = true; return parentCategory.SubCategories.Count; }
public override int DiscoverDynamicCategories() { Settings.Categories.Clear(); string webData = GetWebData(baseUrl); if (!string.IsNullOrEmpty(webData)) { foreach (Match m in mainCategoriesRegex.Matches(webData)) { string url = m.Groups["url"].Value; if (url.IndexOf("binId") == -1) continue; RssLink cat = new RssLink(); cat.Name = m.Groups["title"].Value; string binId = HttpUtility.ParseQueryString(new Uri(url).Query)["binId"]; cat.Url = string.Format(videoListUrlFormat, baseUrl, binId, "1"); cat.HasSubCategories = false; Settings.Categories.Add(cat); } } Settings.DynamicCategoriesDiscovered = true; return Settings.Categories.Count; }
public override int DiscoverDynamicCategories() { redirectedSwfUrl = WebCache.Instance.GetRedirectedUrl(swfUrl); // rtmplib does not work with redirected urls to swf files - we find the actual url here JObject config = GetWebData<JObject>(apiConfig); JToken formats = config["views"].First(v => v["name"].Value<string>() == "formats"); string url = formats["_links"]["url"]["href"].Value<string>(); JToken categories = formats["filters"]["categories"]; JToken channels = formats["filters"]["channels"]; foreach (JToken channel in channels) { RssLink channelCat = new RssLink() { Name = channel["default"] != null && channel["default"].Value<bool>() ? tAll : channel["name"].Value<string>(), HasSubCategories = true, Url = url, Other = "titles" }; channelCat.Url = channelCat.Url.Replace("{channels}", channel["value"].Value<string>()); channelCat.Url = channelCat.Url.Replace("{categories}", categories.First(c => c["default"].Value<bool>())["value"].Value<string>()); channelCat.Url += "&order=title"; Settings.Categories.Add(channelCat); } Settings.DynamicCategoriesDiscovered = Settings.Categories.Count > 0; return Settings.Categories.Count; }
public override int DiscoverDynamicCategories() { RssLink cat = new RssLink(); cat.Url = "http://www.mytaratata.com/Pages/EMISSIONS_accueil.aspx"; cat.Name = "Emissions"; cat.HasSubCategories = true; Settings.Categories.Add(cat); cat = new RssLink(); cat.Url = "http://www.mytaratata.com/Pages/VIDEO_accueil.aspx"; cat.Name = "Vidéos"; cat.HasSubCategories = true; Settings.Categories.Add(cat); cat = new RssLink(); cat.Url = "http://www.mytaratata.com/Pages/ARTISTES_accueil.aspx"; cat.Name = "Artistes"; cat.HasSubCategories = true; Settings.Categories.Add(cat); cat = new RssLink(); cat.Url = "http://www.mytaratata.com/Pages/JEUNES_TALENTS_accueil.aspx"; cat.Name = "Jeunes talents"; cat.HasSubCategories = true; Settings.Categories.Add(cat); Settings.DynamicCategoriesDiscovered = true; return(4); }
public override int DiscoverDynamicCategories() { var html = GetWebData<HtmlDocument>(categoriesUrl); Settings.Categories.Clear(); var ol = html.DocumentNode.Descendants("ol").Where(o => o.GetAttributeValue("class", "") == "mt-view-level_1").First(); foreach (var li in ol.Elements("li")) { var a = li.Descendants("a").FirstOrDefault(); if (a != null) { var url = a.GetAttributeValue("href", ""); url = string.Format(videosUrl, url.Substring(url.LastIndexOf("?") + 1)); RssLink category = new RssLink() { Url = url, Name = a.InnerText.Trim() }; var img = li.Descendants("img").FirstOrDefault(); if (img != null) category.Thumb = "http://mediathek.rbb-online.de" + img.GetAttributeValue("src", ""); var span = li.Descendants("span").FirstOrDefault(); if (span != null) category.EstimatedVideoCount = uint.Parse(span.InnerText.Substring(0, span.InnerText.IndexOf(' '))); Settings.Categories.Add(category); } } Settings.DynamicCategoriesDiscovered = Settings.Categories.Count > 0; return Settings.Categories.Count; }
public override int DiscoverSubCategories(Category parentCategory) { if (parentCategory.SubCategories == null) parentCategory.SubCategories = new List<Category>(); string url = ((RssLink)parentCategory).Url; HtmlDocument htmlDoc = GetHtmlDocument(url); HtmlNodeCollection nodeCollection = htmlDoc.DocumentNode.SelectNodes("//h2[@class = 'showcase-heading']"); foreach (HtmlNode node in nodeCollection) { RssLink cat = new RssLink() { ParentCategory = parentCategory, Name = node.InnerText, HasSubCategories = parentCategory.Other == null, Url = ((RssLink)parentCategory).Url }; if (!cat.HasSubCategories) { cat.Other = NextRealSibling(node);//ParseVideos(url, node.NextSibling); parentCategory.SubCategories.Add(cat); } else { if (ParseSubCategories(cat, node.NextSibling) > 0) parentCategory.SubCategories.Add(cat); } } parentCategory.SubCategoriesDiscovered = true; return parentCategory.SubCategories.Count; }
public override int DiscoverDynamicCategories() { Settings.Categories.Clear(); string webData = GetWebData(baseUrl); if (!string.IsNullOrEmpty(webData)) { foreach (Match m in regEx_dynamicCategories.Matches(webData)) { RssLink cat = new RssLink() { Name = HttpUtility.HtmlDecode(m.Groups["title"].Value), Url = m.Groups["url"].Value, Thumb = m.Groups["thumb"].Value, Description = HttpUtility.HtmlDecode(m.Groups["description"].Value), HasSubCategories = true }; Settings.Categories.Add(cat); } } Settings.DynamicCategoriesDiscovered = true; return(Settings.Categories.Count); }
public override int DiscoverSubCategories(Category parentCategory) { string url = ((RssLink)parentCategory).Url; bool isAZ = !url.Contains("/tv"); if (isAZ) return SubcatFromAZ((RssLink)parentCategory); parentCategory.SubCategories = new List<Category>(); string catUrl = ((RssLink)parentCategory).Url + "/kaikki.json?from=0&to=24"; string webData = GetWebData(catUrl, forceUTF8: true); JToken j = JToken.Parse(webData); JArray orders = j["filters"]["jarjestys"] as JArray; parentCategory.SubCategories = new List<Category>(); foreach (JToken order in orders) { string orderBy = order.Value<string>("key"); RssLink subcat = new RssLink() { Name = orderBy, Url = ((RssLink)parentCategory).Url + "/kaikki.json?jarjestys=" + orderBy + '&', ParentCategory = parentCategory, }; parentCategory.SubCategories.Add(subcat); } parentCategory.SubCategoriesDiscovered = true; return parentCategory.SubCategories.Count; }
public override int DiscoverDynamicCategories() { var htmlDoc = new HtmlAgilityPack.HtmlDocument(); htmlDoc.LoadHtml(GetWebData(baseUrl)); var div = htmlDoc.DocumentNode.SelectSingleNode("//div[@id = 'navigering-content']"); var a_s = div.Elements("ul").SelectMany(u => u.Descendants("a")).ToList(); Settings.Categories.Clear(); foreach (var a in a_s.Where(elt => !ignoreCategories.Contains(elt.InnerText.Trim()))) { var span = a.Element("span"); if (span != null) { a.RemoveChild(span); } var name = HttpUtility.HtmlDecode((a.InnerText)).Trim(); RssLink category = new RssLink() { HasSubCategories = !noSubCategories.Contains(name), SubCategories = new List<Category>(), Url = HttpUtility.HtmlDecode(a.GetAttributeValue("href", "")) + "?product_type=programtv", Name = name, }; Settings.Categories.Add(category); } Settings.DynamicCategoriesDiscovered = Settings.Categories.Count > 0; return Settings.Categories.Count; }
int getShowsList(Category parentCategory) { string html = GetWebData((parentCategory as RssLink).Url); List <Category> subCats = new List <Category>(); foreach (Match match in showsRegex.Matches(html)) { RssLink cat = new RssLink(); cat.ParentCategory = parentCategory; cat.Url = match.Groups[2].Value; cat.Name = cleanString(match.Groups[3].Value); string thumb = match.Groups[1].Value; if (!string.IsNullOrEmpty(thumbReplaceRegExPattern)) { thumb = Regex.Replace(thumb, thumbReplaceRegExPattern, thumbReplaceString); } cat.Thumb = thumb; cat.EstimatedVideoCount = uint.Parse(match.Groups[4].Value); cat.Other = CategoryType.Default; subCats.Add(cat); } parentCategory.SubCategories = subCats; parentCategory.SubCategoriesDiscovered = true; return(subCats.Count); }
public override int DiscoverDynamicCategories() { string data = GetWebData(baseUrl).Substring(12); JObject contentData = JObject.Parse(data); foreach (KeyValuePair <string, JToken> item in contentData) { RssLink categ = new RssLink() { Name = item.Key, Thumb = item.Value.Value <string>("thumbnail"), SubCategories = new List <Category>(), HasSubCategories = true, SubCategoriesDiscovered = true }; Settings.Categories.Add(categ); Add1Subcat(categ, "Featured", item.Value.Value <string>("furl")); Add1Subcat(categ, "Latest", item.Value.Value <string>("url")); Add1Subcat(categ, "Most Popular", item.Value.Value <string>("purl")); AddSubcats(categ, item.Value.Value <JToken>("children"), true); } Settings.DynamicCategoriesDiscovered = true; return(Settings.Categories.Count); }
private void AddSubcats(Category parentCategory, JToken sub, bool getFirst) { if (sub != null) foreach (JToken v in sub) { JToken first = v is JProperty ? v.First : v; RssLink subcat = new RssLink() { Name = first.Value<string>("name"), Thumb = first.Value<string>("thumbnail"), Url = first.Value<string>("url"), ParentCategory = parentCategory }; if (!String.IsNullOrEmpty(subcat.Url)) { if (!Uri.IsWellFormedUriString(subcat.Url, System.UriKind.Absolute)) subcat.Url = new Uri(new Uri(baseUrl), subcat.Url).AbsoluteUri; parentCategory.HasSubCategories = true; parentCategory.SubCategoriesDiscovered = true; if (parentCategory.SubCategories == null) parentCategory.SubCategories = new List<Category>(); parentCategory.SubCategories.Add(subcat); JToken subs = first.Value<JToken>("children"); if (subs != null) AddSubcats(subcat, subs, false); } } }
public override int DiscoverSubCategories(Category parentCategory) { string other = parentCategory.GetOtherAsString(); string url = baseUrl + (parentCategory as RssLink).Url; if (string.IsNullOrEmpty(other)) { parentCategory.SubCategories = DiscoverSubCategoriesFromListing(url); } else { string data = GetWebData(url); Regex r = new Regex(@"showRowText"">(?<n>.*?)</div>.*?<a href=""(?<u>[^""]*?-" + other + @")""", RegexOptions.Singleline); parentCategory.SubCategories = new List <Category>(); foreach (Match m in r.Matches(data)) { RssLink cat = new RssLink() { Name = m.Groups["n"].Value, Url = m.Groups["u"].Value, HasSubCategories = other == "shows" }; parentCategory.SubCategories.Add(cat); } } parentCategory.SubCategories.ForEach(c => c.ParentCategory = parentCategory); parentCategory.SubCategoriesDiscovered = parentCategory.SubCategories.Count() > 0; return(parentCategory.SubCategories.Count()); }
private List <Category> DiscoverSubCategoriesFromListing(string url) { List <Category> cats = new List <Category>(); string data = GetWebData(url); Regex 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)) { RssLink cat = new RssLink() { Name = m.Groups["n"].Value, Thumb = m.Groups["i"].Value, Url = m.Groups["u"].Value, Description = "Quality: " + m.Groups["q"].Value.Trim(), HasSubCategories = false }; cats.Add(cat); } string nextUrl = GetNextLink(data); if (!string.IsNullOrEmpty(nextUrl)) { NextPageCategory next = new NextPageCategory(); next.Url = nextUrl; cats.Add(next); } return(cats); }
public override int DiscoverDynamicCategories() { currentCountry = countries.FirstOrDefault(c => c.Name == country.ToString()) as RssLink; string data = GetWebData(currentCountry.Url); string pattern = @"class=""watch"">\s*<a\shref=""(?<url>[^""]*)(?:(?!title_pokemontv).)*title_pokemontv"">(?<title>[^<]*)"; RegexOptions regexOptions = RegexOptions.Singleline; Regex regex = new Regex(pattern, regexOptions); Match m = regex.Match(data); if (m.Success) { Settings.Categories.Add( new RssLink() { Name = m.Groups["title"].Value.Trim(), Url = "http://www.pokemon.com" + m.Groups["url"].Value }); } pattern = @"<a\shref=""(?<url>[^""]*)""\srel=""""\stitle="""">\s*(?<title>[^<]*)<i\sclass=""icon-"; regex = new Regex(pattern, regexOptions); m = regex.Match(data); if (m.Success) { Settings.Categories.Add( new RssLink() { Name = m.Groups["title"].Value.Trim() + " (" + currentCountry.Name + ")", HasSubCategories = true, SubCategoriesDiscovered = true, SubCategories = countries }); } Settings.DynamicCategoriesDiscovered = Settings.Categories.Count == 2; return(Settings.Categories.Count); }
public override int DiscoverSubCategories(Category parentCategory) { XmlDocument doc = new XmlDocument(); string xmlData = GetWebData(((RssLink)parentCategory).Url, forceUTF8: true); doc.LoadXml(xmlData); XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("a", "http://www.w3.org/2005/Atom"); parentCategory.SubCategories = new List <Category>(); foreach (XmlNode node in doc.SelectNodes(@"a:feed/a:entry", nsmgr)) { RssLink cat = new RssLink(); cat.ParentCategory = parentCategory; cat.Name = node.SelectSingleNode("a:title", nsmgr).InnerText; cat.Url = node.SelectSingleNode("a:id", nsmgr).InnerText; if (String.IsNullOrEmpty(cat.Url)) { cat.Url = String.Format(@"http://dj.rte.ie/vodfeeds/feedgenerator/az/?id={0}", cat.Name); } parentCategory.SubCategories.Add(cat); } parentCategory.SubCategoriesDiscovered = true; return(parentCategory.SubCategories.Count); }
public override int DiscoverDynamicCategories() { string data = GetWebData(baseUrl).Substring(12); JObject contentData = JObject.Parse(data); foreach (KeyValuePair<string, JToken> item in contentData) { RssLink categ = new RssLink() { Name = item.Key, Thumb = item.Value.Value<string>("thumbnail"), SubCategories = new List<Category>(), HasSubCategories = true, SubCategoriesDiscovered = true }; Settings.Categories.Add(categ); Add1Subcat(categ, "Featured", item.Value.Value<string>("furl")); Add1Subcat(categ, "Latest", item.Value.Value<string>("url")); Add1Subcat(categ, "Most Popular", item.Value.Value<string>("purl")); AddSubcats(categ, item.Value.Value<JToken>("children"), true); } Settings.DynamicCategoriesDiscovered = true; return Settings.Categories.Count; }
public override int DiscoverDynamicCategories() { string data = GetWebData(baseUrl); string[] subs = data.Split(new[] { @"class=""menu-item menu-item-type-custom menu-item-object-custom menu-item" }, StringSplitOptions.RemoveEmptyEntries); data = Helpers.StringUtils.GetSubString(data, @"<div id=""navArea"" class=""menu-main-menu-container"">", @"</div"); data = @"<?xml version=""1.0"" encoding=""iso-8859-1""?>" + data; XmlDocument doc = new XmlDocument(); doc.LoadXml(data); XmlNodeList cats = doc.SelectNodes(@"//ul[@id=""menu-main-menu""]/li"); foreach (XmlNode node in cats) { RssLink cat = new RssLink(); XmlNode a = node.SelectSingleNode("a"); cat.Name = a.InnerText; XmlNode sub = node.SelectSingleNode("ul"); cat.HasSubCategories = sub != null; if (cat.HasSubCategories) AddSubcats(cat, sub); else cat.Url = a.Attributes["href"].Value; Settings.Categories.Add(cat); } Settings.DynamicCategoriesDiscovered = true; return Settings.Categories.Count; }
public override int DiscoverDynamicCategories() { string data = GetWebData(baseUrl); string[] subs = data.Split(new[] { @"class=""menu-item menu-item-type-custom menu-item-object-custom menu-item" }, StringSplitOptions.RemoveEmptyEntries); data = Helpers.StringUtils.GetSubString(data, @"<div id=""navArea"" class=""menu-main-menu-container"">", @"</div"); data = @"<?xml version=""1.0"" encoding=""iso-8859-1""?>" + data; XmlDocument doc = new XmlDocument(); doc.LoadXml(data); XmlNodeList cats = doc.SelectNodes(@"//ul[@id=""menu-main-menu""]/li"); foreach (XmlNode node in cats) { RssLink cat = new RssLink(); XmlNode a = node.SelectSingleNode("a"); cat.Name = a.InnerText; XmlNode sub = node.SelectSingleNode("ul"); cat.HasSubCategories = sub != null; if (cat.HasSubCategories) { AddSubcats(cat, sub); } else { cat.Url = a.Attributes["href"].Value; } Settings.Categories.Add(cat); } Settings.DynamicCategoriesDiscovered = true; return(Settings.Categories.Count); }
public override int DiscoverDynamicCategories() { Settings.Categories.Clear(); HtmlDocument html = GetWebData <HtmlDocument>(baseUrl); string currentParentTitle = string.Empty; if (html != null) { foreach (HtmlNode div in html.DocumentNode.SelectNodes(mainCategoryXpath)) { HtmlNode h2 = div.SelectSingleNode(@"./h2[@class = 'sh1']"); HtmlNode anchor = div.SelectSingleNode(@"./a"); RssLink category = new RssLink() { Name = h2.InnerText, Url = string.Format(videoListUrlFormat, anchor.GetAttributeValue("rel", ""), "1"), Other = anchor.GetAttributeValue("rel", ""), HasSubCategories = false }; Settings.Categories.Add(category); } } return(Settings.Categories.Count); }
public override int ParseSubCategories(Category parentCategory, string data) { List <Category> dynamicSubCategories = new List <Category>(); // put all new discovered Categories in a separate list JObject jsonData = GetWebData <JObject>((parentCategory as RssLink).Url); Log.Debug("Number of items: " + jsonData["meta"].Value <string>("nr_of_items_total")); if (jsonData != null) { foreach (JToken item in jsonData["abstracts"]) { RssLink cat = new RssLink(); cat.Url = String.Format("http://www.rtl.nl/system/s4m/vfd/version=2/fun=abstract/d=a3t/fmt=progressive/ak={0}/output=json/pg=1/", item.Value <string>("key")); cat.Name = item.Value <string>("name"); cat.Thumb = jsonData["meta"].Value <string>("poster_base_url") + item.Value <string>("coverurl"); cat.Description = item.Value <string>("synopsis"); cat.ParentCategory = parentCategory; dynamicSubCategories.Add(cat); } // discovery finished, copy them to the actual list -> prevents double entries if error occurs in the middle of adding if (parentCategory.SubCategories == null) { parentCategory.SubCategories = new List <Category>(); } foreach (Category cat in dynamicSubCategories) { parentCategory.SubCategories.Add(cat); } parentCategory.SubCategoriesDiscovered = dynamicSubCategories.Count > 0; // only set to true if actually discovered (forces re-discovery until found) } return(parentCategory.SubCategories == null ? 0 : parentCategory.SubCategories.Count); }
private void AddSubcats(XmlNode node, Category parentCategory) { RssLink cat = new RssLink(); cat.Name = HttpUtility.HtmlDecode(node.SelectSingleNode("a/span").InnerText); cat.Url = baseUrl + node.SelectSingleNode("a").Attributes["href"].Value; cat.SubCategoriesDiscovered = true; if (parentCategory == null) { Settings.Categories.Add(cat); } else { if (parentCategory.SubCategories == null) { parentCategory.SubCategories = new List <Category>(); } parentCategory.SubCategories.Add(cat); cat.ParentCategory = parentCategory; } XmlNodeList subs = node.SelectNodes("div/ul/li"); foreach (XmlNode sub in subs) { cat.HasSubCategories = true; AddSubcats(sub, cat); } }
public override int DiscoverDynamicCategories() { redirectedSwfUrl = WebCache.Instance.GetRedirectedUrl(swfUrl); // rtmplib does not work with redirected urls to swf files - we find the actual url here JObject config = GetWebData <JObject>(apiConfig); JToken formats = config["views"].First(v => v["name"].Value <string>() == "formats"); string url = formats["_links"]["url"]["href"].Value <string>(); JToken categories = formats["filters"]["categories"]; JToken channels = formats["filters"]["channels"]; foreach (JToken channel in channels) { RssLink channelCat = new RssLink() { Name = channel["default"] != null && channel["default"].Value <bool>() ? tAll : channel["name"].Value <string>(), HasSubCategories = true, Url = url, Other = "titles" }; channelCat.Url = channelCat.Url.Replace("{channels}", channel["value"].Value <string>()); channelCat.Url = channelCat.Url.Replace("{categories}", categories.First(c => c["default"].Value <bool>())["value"].Value <string>()); channelCat.Url += "&order=title"; Settings.Categories.Add(channelCat); } Settings.DynamicCategoriesDiscovered = Settings.Categories.Count > 0; return(Settings.Categories.Count); }
private int OneSeries(Category parentcat, string url) { parentcat.SubCategories = new List <Category>(); var json = GetWebData <JObject>(url); foreach (var component in json["components"]) { if (component["type"].Value <string>() == "TabContainer") { foreach (var item in component["content"]["items"]) { var query = item["content"]["items"][0]["content"]["query"]; RssLink cat = new RssLink() { Name = item["label"]["text"].Value <String>(), Url = query["url"].Value <String>() + "?offset=0&limit=200¤t_season_id=" + query["params"]["current_season_id"] + "¤t_series_id=" + query["params"]["current_series_id"] + "&app=ruutu&client=web", ParentCategory = parentcat }; parentcat.SubCategories.Add(cat); } } } parentcat.SubCategoriesDiscovered = true; return(parentcat.SubCategories.Count); }
private RssLink DiscoverCategoryFromArticle(HtmlNode article) { RssLink cat = new RssLink(); cat.Description = HttpUtility.HtmlDecode(article.GetAttributeValue("data-description", "")); HtmlNode a = article.Descendants("a").First(); Uri uri = new Uri(new Uri(baseUrl), a.GetAttributeValue("href", "")); cat.Url = uri.ToString(); IEnumerable <HtmlNode> imgs = a.Descendants("img"); if (imgs != null && imgs.Count() > 0) { uri = new Uri(new Uri(baseUrl), a.Descendants("img").First().GetAttributeValue("src", "")); cat.Thumb = uri.ToString(); } HtmlNode fcap = a.SelectSingleNode(".//figcaption"); if (fcap != null) { cat.Name = HttpUtility.HtmlDecode(fcap.InnerText); } else { cat.Name = HttpUtility.HtmlDecode(article.GetAttributeValue("data-title", "")); } cat.Name = (cat.Name ?? "").Trim(); if (cat.Name.ToLower().Contains("oppetarkiv")) { cat.Name = _oppetArkiv; cat.Url = oppetArkivListUrl; } return(cat); }
public override int DiscoverDynamicCategories() { var htmlDoc = new HtmlAgilityPack.HtmlDocument(); htmlDoc.LoadHtml(GetWebData(baseUrl)); var div = htmlDoc.DocumentNode.SelectSingleNode("//div[@id = 'navigering-content']"); var a_s = div.Elements("ul").SelectMany(u => u.Descendants("a")).ToList(); Settings.Categories.Clear(); foreach (var a in a_s.Where(elt => !ignoreCategories.Contains(elt.InnerText.Trim()))) { var span = a.Element("span"); if (span != null) { a.RemoveChild(span); } var name = HttpUtility.HtmlDecode((a.InnerText)).Trim(); RssLink category = new RssLink() { HasSubCategories = !noSubCategories.Contains(name), SubCategories = new List <Category>(), Url = HttpUtility.HtmlDecode(a.GetAttributeValue("href", "")) + "?product_type=programtv", Name = name, }; Settings.Categories.Add(category); } Settings.DynamicCategoriesDiscovered = Settings.Categories.Count > 0; return(Settings.Categories.Count); }
public override List <VideoInfo> GetVideos(Category category) { RssLink parentCategory = category as RssLink; List <VideoInfo> videoList = new List <VideoInfo>(); String data = GetWebData(parentCategory.Url); string inicioUrl = parentCategory.Url; // Si estamos filtrando por categorías elegimos el div de la categoría if ((CategoryType)category.ParentCategory.Other == CategoryType.categorias) { inicioUrl = baseUrl; string id_categoria = parentCategory.Url.Substring(parentCategory.Url.LastIndexOf("/") + 2); regEx_dynamicSubCategories = new Regex(secciones_categoriasRegEx.Replace("ID_CATEGORIA", id_categoria), defaultRegexOptions); Match matchCat = regEx_dynamicSubCategories.Match(data); if (matchCat.Success) { data = matchCat.Groups["contenido"].Value; } } regEx_dynamicSubCategories = new Regex(videosRegEx, defaultRegexOptions); Match match = regEx_dynamicSubCategories.Match(data); while (match.Success) { VideoInfo video = new VideoInfo(); video.Title = match.Groups["title"].Value; video.VideoUrl = inicioUrl + match.Groups["url"].Value; video.Description = match.Groups["description"].Value; video.Thumb = match.Groups["thumb"].Value; videoList.Add(video); match = match.NextMatch(); } return(videoList); }
/*public void GetBaseCookie() * { * HttpWebRequest request = WebRequest.Create(baseUrl) as HttpWebRequest; * if (request == null) return; * request.UserAgent = OnlineVideoSettings.Instance.UserAgent; * request.Accept = "* /*"; * request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate"); * request.CookieContainer = new CookieContainer(); * HttpWebResponse response = null; * try * { * response = (HttpWebResponse)request.GetResponse(); * } * finally * { * if (response != null) ((IDisposable)response).Dispose(); * } * * cc = new CookieContainer(); * CookieCollection ccol = request.CookieContainer.GetCookies(new Uri(baseUrl)); * foreach (Cookie c in ccol) * cc.Add(c); * } */ public override int DiscoverDynamicCategories() { //GetBaseCookie(); regex_Az = new Regex(azRegEx, defaultRegexOptions); base.DiscoverDynamicCategories(); int i = 0; do { RssLink cat = (RssLink)Settings.Categories[i]; if (cat.Name.ToUpperInvariant() == "HOME" || cat.Name.ToUpperInvariant() == "HOW TO WATCH" || cat.Name.ToUpperInvariant() == "CONTACT" || cat.Name.ToUpperInvariant() == "ABOUT US" || cat.Name.ToUpperInvariant() == "SPORT" ) { Settings.Categories.Remove(cat); } else { if (cat.Name == "Series") { cat.Other = Depth.MainMenu; } else { cat.Other = Depth.BareList; cat.HasSubCategories = false; } i++; } }while (i < Settings.Categories.Count); return(Settings.Categories.Count); }
public override int DiscoverDynamicCategories() { _thread = new System.Threading.Thread(new System.Threading.ThreadStart(ReadEPG)); _thread.Start(); Settings.Categories.Clear(); RssLink cat = null; cat = new RssLink() { Name = "Channels", Other = "channels", Thumb = "http://arenavision.in/sites/default/files/FAVICON_AV2015.png", HasSubCategories = false }; Settings.Categories.Add(cat); cat = new RssLink() { Name = "Agenda", Other = "agenda", Thumb = "http://arenavision.in/sites/default/files/FAVICON_AV2015.png", HasSubCategories = false }; Settings.Categories.Add(cat); Settings.DynamicCategoriesDiscovered = true; return(Settings.Categories.Count); }
private List <VideoInfo> GetVideoList(Category category) { hasNextPage = false; String baseWebData = String.Empty; RssLink parentCategory = (RssLink)category; List <VideoInfo> videoList = new List <VideoInfo>(); if (parentCategory.Name != this.currentCategory.Name) { this.currentStartIndex = 0; this.nextPageUrl = parentCategory.Url; this.loadedEpisodes.Clear(); } this.currentCategory = parentCategory; this.loadedEpisodes.AddRange(this.GetPageVideos(this.nextPageUrl)); while (this.currentStartIndex < this.loadedEpisodes.Count) { videoList.Add(this.loadedEpisodes[this.currentStartIndex++]); } if (!String.IsNullOrEmpty(this.nextPageUrl)) { hasNextPage = true; } return(videoList); }
public override int DiscoverSubCategories(Category parentCategory) { parentCategory.SubCategories = new List<Category>(); string url = ((RssLink) parentCategory).Url; string webData = GetWebData(url); if (webData != null) { foreach (Match m in subcategoryMainRegex.Matches(webData)) { // skip this match unless title is same as category name if (!parentCategory.Name.Equals(m.Groups["title"].Value)) continue; string categories = m.Groups["categories"].Value; if (categories != null) { foreach (Match categoryMatch in subcategoryEntriesRegex.Matches(categories)) { RssLink cat = new RssLink(); cat.ParentCategory = parentCategory; cat.Name = HttpUtility.HtmlDecode(categoryMatch.Groups["title"].Value); cat.Url = string.Format(@"{0}{1}", baseUrlPrefix, categoryMatch.Groups["url"].Value.Trim()); cat.HasSubCategories = false; parentCategory.SubCategories.Add(cat); } } } } parentCategory.SubCategoriesDiscovered = true; return parentCategory.SubCategories.Count; }
private List <Category> GetSubCategories(RssLink parentCategory, bool skipLogIn = false) { HtmlDocument doc = MyGetWebData <HtmlDocument>(baseUrl + parentCategory.Url); List <Category> videos = new List <Category>(); foreach (HtmlNode item in doc.DocumentNode.Descendants("a").Where(a => a.SelectNodes("div[@class = 'image-wrapper']") != null && !a.Descendants("i").Any())) { videos.Add(new RssLink() { Name = HttpUtility.HtmlDecode(item.Descendants("h5").FirstOrDefault().InnerText.Trim()), Url = item.GetAttributeValue("data-movieid", ""), Thumb = item.SelectSingleNode("div/img").GetAttributeValue("src", ""), Description = HttpUtility.HtmlDecode(item.SelectSingleNode("div/div/p").InnerText.Trim().Replace("Releasedatum:", "\nReleasedatum:").Replace("IMDB betyg:", "\nIMDB betyg:")), ParentCategory = parentCategory is NextPageCategory ? parentCategory.ParentCategory : parentCategory }); } if (videos.Count > 0) { HtmlNode baut = doc.DocumentNode.Descendants("div").FirstOrDefault(d => d.GetAttributeValue("class", "") == "baut"); if (baut != null) { HtmlNode next = baut.Descendants("a").FirstOrDefault(a => a.InnerText.Contains("Nästa sida")); if (next != null) { videos.Add(new NextPageCategory() { Url = next.GetAttributeValue("href", ""), ParentCategory = parentCategory is NextPageCategory ? parentCategory.ParentCategory : parentCategory }); } } } return(videos); }
private void AddSubcats(Category parentCat, XmlNode categNode) { parentCat.HasSubCategories = true; parentCat.SubCategories = new List <Category>(); foreach (XmlNode subCategNode in categNode.SelectNodes(@"subcategories/subcategory")) { RssLink cat = new RssLink(); cat.Name = subCategNode.Attributes["name"].Value; cat.Url = subCategNode.Attributes["url"].Value; cat.Other = subCategNode.Attributes["word"].Value; cat.ParentCategory = parentCat; parentCat.SubCategories.Add(cat); } ; RssLink videosCat = new RssLink() { Name = "Videos", Url = categNode.SelectSingleNode("url").InnerText, Other = categNode.Attributes["word"].Value, ParentCategory = parentCat }; parentCat.SubCategories.Add(videosCat); parentCat.SubCategoriesDiscovered = true; }
public override List <VideoInfo> GetLatestVideos() { List <VideoInfo> videos = new List <VideoInfo>(); try { List <VideoInfo> temp; RssLink latest = new RssLink() { Name = "Senast inlagda", Url = latestUrl }; List <Category> cats = GetSubCategories(latest); foreach (Category cat in cats) { temp = GetVideos(cat); if (temp.Count == 1) { videos.Add(temp.First()); if (videos.Count == LatestVideosCount) { break; } } } } catch { /* if failed log in*/ } return(videos); }
public override int DiscoverDynamicCategories() { Category series = new Category() { Name = "Serier", SubCategories = new List <Category>(), SubCategoriesDiscovered = true, HasSubCategories = true, }; Category programs = new Category() { Name = "Program", SubCategories = new List <Category>(), SubCategoriesDiscovered = true, HasSubCategories = true, }; RssLink spelistor = new RssLink() { Name = "Spellistor", Url = "http://urplay.se/sok?age=&product_type=playlists&query=&type=programtv", HasSubCategories = true, Other = episodeVideosState }; foreach (KeyValuePair <string, string> genre in tvCategories) { series.SubCategories.Add(new RssLink() { Name = genre.Key, Url = string.Format("http://urplay.se/sok?age=&product_type=series&query=&rows=1000&type=programtv&view=title&play_category={0}", genre.Value), HasSubCategories = true, ParentCategory = series }); string programurl = "http://urplay.se/sok?age=&product_type=program&query=&rows=20&type=programtv&play_category={0}&view={1}&start="; RssLink program = new RssLink() { Name = genre.Key, HasSubCategories = true, ParentCategory = programs, SubCategories = new List <Category>(), SubCategoriesDiscovered = true }; foreach (KeyValuePair <string, string> programSortering in programSorteringar) { program.SubCategories.Add(new RssLink() { Name = programSortering.Key, Url = string.Format(programurl, genre.Value, programSortering.Value) + "{0}", HasSubCategories = false, ParentCategory = program }); } programs.SubCategories.Add(program); } Settings.Categories.Add(series); Settings.Categories.Add(programs); Settings.Categories.Add(spelistor); Settings.DynamicCategoriesDiscovered = Settings.Categories.Count > 0; return(Settings.Categories.Count); }
public override int DiscoverDynamicCategories() { if (Settings.Categories.Count < 1 || DateTime.Now.Subtract(lastRefresh).TotalSeconds > refreshIntervalSeconds) { List <Category> cats = new List <Category>(); string html = GetWebData("http://livetv.ru/en/allupcomingsports"); foreach (Match m in new Regex(categoryRegex, RegexOptions.Singleline).Matches(html)) { RssLink cat = new RssLink(); cat.Thumb = m.Groups["thumb"].Value; cat.Name = m.Groups["title"].Value; cat.HasSubCategories = true; cat.Url = m.Groups["subcats"].Value; cat.Other = onlyShowCurrentlyPlaying; cats.Add(cat); } Settings.Categories = new System.ComponentModel.BindingList <Category>(); foreach (Category cat in cats) { Settings.Categories.Add(cat); } lastRefresh = DateTime.Now; } return(Settings.Categories.Count); }
public override int DiscoverDynamicCategories() { _thread = new System.Threading.Thread(new System.Threading.ThreadStart(ReadEPG)); _thread.Start(); Settings.Categories.Clear(); RssLink cat = null; cat = new RssLink() { Name = "Channels", Other = "channels", Thumb = "http://arenavision.in/sites/default/files/FAVICON_AV2015.png", HasSubCategories = false }; Settings.Categories.Add(cat); cat = new RssLink() { Name = "Agenda", Other = "agenda", Thumb = "http://arenavision.in/sites/default/files/FAVICON_AV2015.png", HasSubCategories = false }; Settings.Categories.Add(cat); Settings.DynamicCategoriesDiscovered = true; return Settings.Categories.Count; }
private int Series(HtmlDocument doc, Category parentcat, string kind) { int offset = (int)parentcat.Other; var json = GetWebData <JObject>(((RssLink)parentcat).Url + offset.ToString()); parentcat.SubCategories = new List <Category>(); foreach (var item in json["items"]) { RssLink cat = new RssLink() { Name = item["title"].Value <string>(), Description = item["description"].Value <string>(), Thumb = item["media"]["images"]["640x360"].Value <string>(), Url = @"https://prod-component-api.nm-services.nelonenmedia.fi/api/" + kind + "/" + item["link"]["target"]["value"].Value <string>() + "?userroles=anonymous&clients=ruutufi%2Cruutufi-react", HasSubCategories = true, ParentCategory = parentcat }; parentcat.SubCategories.Add(cat); } if (json["hits"].Value <int>() >= offset + parentcat.SubCategories.Count) { var nextPage = new NextPageCategory() { Url = ((RssLink)parentcat).Url, Other = offset + 20 }; parentcat.SubCategories.Add(nextPage); } parentcat.SubCategoriesDiscovered = true; return(parentcat.SubCategories.Count); }
public override int DiscoverDynamicCategories() { if (Settings.Categories == null) { Settings.Categories = new BindingList <Category>(); } cc = new CookieContainer(); string data = GetWebData(@"https://www.filmon.com/tv/live", userAgent: userAgent, cookies: cc); string jsondata = @"{""result"":" + Helpers.StringUtils.GetSubString(data, "var groups =", @"if(!$.isArray").Trim().TrimEnd(';') + "}"; JToken jt = JObject.Parse(jsondata) as JToken; foreach (JToken jCat in jt["result"] as JArray) { RssLink cat = new RssLink(); cat.Name = jCat.Value <string>("title"); cat.Description = jCat.Value <string>("description"); cat.Thumb = jCat.Value <string>("logo_uri"); Settings.Categories.Add(cat); JArray channels = jCat["channels"] as JArray; List <VideoInfo> videos = new List <VideoInfo>(); foreach (JToken channel in channels) { VideoInfo video = new VideoInfo(); video.Thumb = channel.Value <string>("logo"); video.Description = channel.Value <string>("description"); video.Title = channel.Value <string>("title"); video.VideoUrl = @"https://www.filmon.com/ajax/getChannelInfo"; video.Other = String.Format(@"channel_id={0}&quality=low", channel.Value <string>("id")); videos.Add(video); } cat.Other = videos; } Settings.DynamicCategoriesDiscovered = true; return(Settings.Categories.Count); }
public override int DiscoverSubCategories(Category parentCategory) { parentCategory.SubCategories = new List<Category>(); string url = (parentCategory as RssLink).Url; url = baseVideos + url; List<RssLink> listDates = new List<RssLink>(); string webData = GetWebData(url); Regex r = new Regex(@"<div\sclass=""present_chaine"">\s*<div\sclass=""img_chaine"">\s*<a\shref=""(?<url>[^""]*)""><img\sclass=""lazy""\ssrc=""[^""]*""\sdata-src=""(?<thumb>[^""]*)""\salt=""[^""]*""\stitle=""(?<title>[^""]*)""\s/></a>", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture); Match m = r.Match(webData); while (m.Success) { RssLink date = new RssLink(); date.Url = m.Groups["url"].Value; date.Name = Helpers.StringUtils.PlainTextFromHtml(HttpUtility.HtmlDecode(m.Groups["title"].Value)); date.Thumb = m.Groups["thumb"].Value; date.ParentCategory = parentCategory; listDates.Add(date); m = m.NextMatch(); } //Recherche des pages suivantes r = new Regex(@"<a\sdata-page=""[^""]*""\sdata-href=""(?<url>[^""]*)""\s*href=""[^""]*""\s>", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture); m = r.Match(webData); m = m.NextMatch(); int nbPages = 0; //Pour chaque page suivante dans la limite de 5 pages while (m.Success && nbPages <= 5) { nbPages++; string webData2 = GetWebData("http://www.wat.tv" + m.Groups["url"].Value); Regex r2 = new Regex(@"<div\sclass=""present_chaine"">\s*<div\sclass=""img_chaine"">\s*<a\shref=""(?<url>[^""]*)""><img\sclass=""lazy""\ssrc=""[^""]*""\sdata-src=""(?<thumb>[^""]*)""\salt=""[^""]*""\stitle=""(?<title>[^""]*)""\s/></a>", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture); Match m2 = r2.Match(webData2); while (m2.Success) { RssLink cat = new RssLink(); cat.Url = m2.Groups["url"].Value; cat.Name = Helpers.StringUtils.PlainTextFromHtml(HttpUtility.HtmlDecode(m2.Groups["title"].Value)); cat.Thumb = m2.Groups["thumb"].Value; cat.ParentCategory = parentCategory; listDates.Add(cat); m2 = m2.NextMatch(); } m = m.NextMatch(); } parentCategory.SubCategories.AddRange(listDates.ToArray()); return listDates.Count; }
public override int DiscoverDynamicCategories() { Category programs = new Category() { Name = "Ohjelmat aakkosittain", HasSubCategories = true }; Settings.Categories.Add(programs); RssLink channels = new RssLink() { Name = "Kanavat", HasSubCategories = false, Url = "33100" }; Settings.Categories.Add(channels); Settings.DynamicCategoriesDiscovered = true; return 2; }
void BtnAddRss_Click(object sender, EventArgs e) { RssLinkList.SelectedIndex = -1; RssLink link = new RssLink() { Name = "new", Url = "http://" }; ((CurrencyManager)BindingContext[bindingSourceRssLink]).List.Add(link); RssLinkList.SelectedIndex = RssLinkList.Items.Count - 1; categoryListBox_SelectedIndexChanged(this, EventArgs.Empty); nameTextBox.Focus(); }