本文整理汇总了C#中Source.CreateChapterSource方法的典型用法代码示例。如果您正苦于以下问题:C# Source.CreateChapterSource方法的具体用法?C# Source.CreateChapterSource怎么用?C# Source.CreateChapterSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Source
的用法示例。
在下文中一共展示了Source.CreateChapterSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getNews
public static IEnumerable<MangaData> getNews(Source source)
{
var web = new HtmlAgilityPack.HtmlWeb();
web.AutoDetectEncoding = true;
var htmlMainDoc = web.Load(@"http://www.mangahere.com/latest/");
var itemsManga = htmlMainDoc.DocumentNode.SelectNodes(@"/html/body/section[@class='page_main']/div[@class='latest_released']/div[@class='manga_updates']/dl");
for (int i = itemsManga.Count-1; i >+0; i--)
{
var itemManga = itemsManga[i];
MangaData manga = new MangaData(source, true);
var mangaNode = itemManga.SelectSingleNode(@"dt");
var mangaName = mangaNode.SelectSingleNode("a").InnerHtml;
var mangaDetailLink = mangaNode.SelectSingleNode("a").GetAttributeValue("href", "");
manga.DetailMangaSource = source.CreateDetailMangaSource(manga, mangaDetailLink);
manga.Name = mangaName;
foreach (var itemChapter in itemManga.SelectNodes("dd"))
{
ChapterData chapter = new ChapterData();
//var matches = Regex.Matches(itemChapter.SelectSingleNode("a").InnerText, @"\d+");
//var chapterName = matches[matches.Count - 1].Value;
var chapterName = itemChapter.SelectSingleNode("a").InnerText;
var chapterLink = itemChapter.SelectSingleNode("a").GetAttributeValue("href", "");
chapter.Name = chapterName;
chapter.ChapterSource = source.CreateChapterSource(chapterLink);
manga.ChaptersData.Add(chapter);
}
yield return manga;
}
}
示例2: getNews
public static IEnumerable<MangaData> getNews(Source source)
{
var web = new HtmlAgilityPack.HtmlWeb();
web.AutoDetectEncoding = true;
var htmlMainDoc = web.Load(@"http://www.mangareader.net/latest");
var itemsManga = htmlMainDoc.DocumentNode.SelectNodes(@"/html/body/div[@id='container']/div[@id='wrapper_body']/div[@id='latest']/div[@id='latestchapters']/table[@class='updates']/tr[@class='c2']");
for (int i = itemsManga.Count-1; i >=0; i--)
{
var itemManga = itemsManga[i];
MangaData manga = new MangaData(source,true);
var mangaNode = itemManga.SelectSingleNode(@"td[2]/a[@class='chapter']");
var mangaName = mangaNode.InnerText;
var mangaDetailLink = "http://www.mangareader.net" + mangaNode.GetAttributeValue("href", "");
manga.DetailMangaSource = source.CreateDetailMangaSource(manga, mangaDetailLink);
manga.Name = mangaName;
foreach (var itemChapter in itemManga.SelectNodes(@"td[2]/a[@class='chaptersrec']"))
{
ChapterData chapter = new ChapterData();
//// ////var matches = Regex.Matches(itemChapter.SelectSingleNode("a").InnerText, @"\d+");
//// ////var chapterName = matches[matches.Count - 1].Value;
var chapterName = itemChapter.InnerText;
var chapterLink = "http://www.mangareader.net" + itemChapter.GetAttributeValue("href", "");
chapter.Name = chapterName;
chapter.ChapterSource = source.CreateChapterSource(chapterLink);
manga.ChaptersData.Add(chapter);
}
yield return manga;
}
}