/// <summary> /// 开始采集子页 /// </summary> /// <returns></returns> public override bool Sniffer() { if (!Succeed || this.Done) { _done = true; return(false); } foreach (Match item in SnifferSubPageUrlMatchCollection) { UrlItem urlItem = new UrlItem(); string url = item.Groups[this.ListPageConfiguration.SnifferSubPageUrlItem.UrlGroupIndex].Value; if (!string.IsNullOrEmpty(this.SnifferSubPageUrlItem.UrlFormat)) { url = string.Format(this.SnifferSubPageUrlItem.UrlFormat, url); } urlItem.Url = FileUtil.GetAbsUrl(url, this.SubPageBaseUrl).Replace("&", "&"); urlItem.Title = item.Groups[this.ListPageConfiguration.SnifferSubPageUrlItem.TitleGroupIndex].Value; this.SubPageUrlResults.Add(urlItem); } _done = true; return(true); }
/// <summary> /// 读取详细页重载 /// </summary> /// <returns></returns> public static DetailPage GetDetailPage(string fileName, string rootPageName, int firstIndex, int pageIndex, int urlIndex) { ListPage firstPage = GetListPage(fileName, rootPageName, firstIndex, pageIndex); UrlItem urlItem = firstPage.SubPageUrlResults[urlIndex]; DetailPageConfiguration detailPageConf = (DetailPageConfiguration)firstPage.ListPageConfiguration.SubPageConfiguration; DetailPage detailPage = new DetailPage(firstPage, detailPageConf); detailPage.PageIndex = detailPageConf.PageStartIndex; detailPage.PageName = urlItem.Title; detailPage.PageUrl = urlItem.Url; detailPage.Sniffer(); return(detailPage); }