public static DUtil CreateDUtil(string url) { DUtil dutil = null; Match match = reHostName.Match(url); string hostname = null; if (match.Success && match.Groups.Count != 0) { hostname = match.Groups[1].Value; } else { return(null); } switch (hostname) { case "www.dmzj.com": dutil = new DUtilDmzj(url); break; // case "manhua.178.com": // dutil = new DUtil178(url); // break; // case "www.imanhua.com": // dutil = new DUtilImanhua(url); // break; case "www.bengou.com": dutil = new DUtilBengou(url); break; default: break; } return(dutil); }
public virtual IList <Page> SplitPaths(string paths, string urlStartWith) { IList <Page> alist = new List <Page>(); int restartat = 0; Match match = reQuote.Match(paths, restartat); int counter = 0; while (match.Success) { string url = urlStartWith; url += DUtil.JScriptEval("\"" + match.Value + "\""); Page page = new Page(++counter, url); alist.Add(page); restartat = match.Index + match.Length + 2; match = reQuote.Match(paths, restartat); } return(alist); }
public virtual IList <Page> SplitPaths(string paths) { IList <Page> alist = new List <Page>(); int restartat = 0; Match match = reQuote.Match(paths, restartat); int counter = 0; while (match.Success) { //<img class="bigimgborder pic_link" alt="" style="border: 1px solid rgb(204, 204, 204); padding: 1px; cursor: pointer;" src="http://imgfast.dmzj.com/j/%E8%BF%9B%E5%87%BB%E7%9A%84%E5%B7%A8%E4%BA%BA/%E7%AC%AC01%E5%8D%B7/002.jpg" name="bigimg2" id="bigimg2" href=""> string url = "http://imgfast.dmzj.com/"; url += DUtil.JScriptEval("\"" + match.Value + "\""); Page page = new Page(++counter, url); alist.Add(page); restartat = match.Index + match.Length + 2; match = reQuote.Match(paths, restartat); } return(alist); }
public override IList <Page> SpiderPages(Chapter chapter) { //throw new NotImplementedException(); IList <Page> alist = null; string html; try { html = LoadHtml(chapter.Url); } catch (Exception ex) { throw ex; } string[] htmlines = html.Split('\n'); foreach (string line in htmlines) { if (line.Contains("var pages")) { //分离这一行 alist = SplitPaths(line); break; } if (line.Contains("eval(")) { string realine = DUtil.JScriptEval(line.Substring(4)); if (realine == null) { continue; } alist = SplitPaths(realine); break; } } chapter.Pages = alist; return(alist); }