本文整理汇总了C#中RssLink类的典型用法代码示例。如果您正苦于以下问题:C# RssLink类的具体用法?C# RssLink怎么用?C# RssLink使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RssLink类属于命名空间,在下文中一共展示了RssLink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DiscoverDynamicCategories
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;
}
示例2: DiscoverSubCategories
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;
}
示例3: DiscoverDynamicCategories
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;
}
示例4: DiscoverDynamicCategories
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;
}
示例5: ParseSubCategories
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;
}
示例6: DiscoverDynamicCategories
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;
}
示例7: DiscoverDynamicCategories
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;
}
示例8: DiscoverDynamicCategories
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;
}
示例9: DiscoverDynamicCategories
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;
}
示例10: DiscoverSubCategories
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;
}
示例11: DiscoverDynamicCategories
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;
}
示例12: DiscoverDynamicCategories
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;
}
示例13: DiscoverDynamicCategories
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;
}
示例14: AddSubcats
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);
}
}
}
示例15: DiscoverDynamicCategories
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;
}