Пример #1
0
 public override IEnumerable<string> GetUrlList(string listUrl)
 {
     try
     {
         using (var http = new HttpHelper(listUrl, SiteEncoding))
         {
             var html = http.GetHtml();
             var url = http.GetRequestUrl();
             if (Regex.IsMatch(url, "^http://www.newegg.com.cn/Product/[0-9a-zA-Z\\-]+.htm$"))
                 return new List<string> {url};
             if (!html.IsNullOrEmpty())
                 html = RegexHelper.ClearTrn(html);
             var showList = HtmlCls.GetHtmlById(html, "itemGrid1");
             var list =
                 RegexHelper.Matches(showList, "(http://www.newegg.com.cn/Product/[0-9a-zA-Z\\-]+.htm)").Distinct()
                     .ToList();
             return
                 list.Where(t => !t.IsNullOrEmpty()).Select(
                     t => Utils.GetAbsoluteUrl(GetWebSiteInfo().BaseUrl, t)).ToList();
         }
     }
     catch (Exception)
     {
         return new List<string>();
     }
 }