public static DmzjWebSpider GetDmzjWebSpiderForKeyWords(string keywords) { DmzjWebSpider spider = new DmzjWebSpider(); spider.KeyWords = keywords; spider.HtmlDocument.LoadHtml(spider.GetSearchHtml()); return(spider); }
static void Main(string[] args) { Console.WriteLine("请输入想要搜索的关键字."); DmzjWebSpider spider = DmzjWebSpider.GetDmzjWebSpiderForKeyWords(Console.ReadLine()); string searchResult = "共找到" + spider.GetSearchCount() + "条结果!"; if (spider.GetSearchCount() == 0) { Console.WriteLine("未能找到对应的漫画!"); Console.ReadKey(); return; } var cartoons = spider.GetCartoons(); PrintComicInfo(cartoons); Console.WriteLine(); var selectCartoon = cartoons[GetSelectCartoomIndex(cartoons.Count)]; Console.WriteLine("当前所选漫画共有" + selectCartoon.Chapters.Count + "章!"); for (int i = 1; i <= selectCartoon.Chapters.Count; i++) { Console.WriteLine("[" + i.ToString() + "]." + selectCartoon.Chapters[i - 1].Name); } int chapterIndex = GetSelectChapterIndex(selectCartoon.Chapters.Count); if (chapterIndex != 0) { selectCartoon.Download(chapterIndex - 1); } else { selectCartoon.Download(); } Console.WriteLine("下载完成!"); Console.ReadKey(); }