public void Download(object obj) { AsynObj o = (AsynObj)obj; try { string[] threads1 = o.Content.Split(new string[] { "版块主题" }, StringSplitOptions.RemoveEmptyEntries); string[] threads = threads1[1].Split(new string[] { "normalthread_", "pages_btns" }, StringSplitOptions.RemoveEmptyEntries); foreach (string thread in threads) { if (thread.Contains("新窗口打开")) { string path; if (thread.Contains("color:")) { path = Path.Combine(o.Path, DlTool.ReplaceUrl(nameRegex1.Match(nameRegex.Match(thread).Value).Value)); } else { path = Path.Combine(o.Path, DlTool.ReplaceUrl(nameRegex1.Match(noColorNameRegex.Match(thread).Value).Value)); } double size = 0; try { string sizeStr = sizeRegex.Matches(thread)[1].Value.Replace("<td class=\"nums\">", "").Replace(" /", "").ToUpper(); string sizeStrWithoutUnit = sizeStr.Replace("GB", "").Replace("G", "").Replace("MB", "").Replace("M", ""); size = Convert.ToDouble(sizeStrWithoutUnit); if (sizeStr.Contains("G")) { size = size * 1024; } } catch { Console.WriteLine("Can not get Size: " + thread); } path += " size^^^" + size + ".htm"; string link = "http://sis001.com/bbs/" + threadRegex.Match(thread).Value.Replace("href=\"", "").Replace("\" title=\"新窗口打开\" target=\"_blank\"><", ""); ThreadPool.QueueUserWorkItem(new Sis001SgDl().work, new AsynObj(path, link)); } } } catch (Exception e) { Config1.appendFile(o.Url, Path.Combine(o.Path, "failList.txt")); } }
public void Download(object obj) { AsynObj o = (AsynObj)obj; try { string[] threads = o.Content.Split(new string[] { "新窗口打开" }, StringSplitOptions.RemoveEmptyEntries); foreach (string thread in threads) { if (thread.Contains("桃花族论坛")) { continue; } string path = Path.Combine(o.Path, DlTool.ReplaceUrl(nameRegex1.Match(nameRegex.Match(thread).Value).Value)) + ".htm"; string link = "http://taohuabt.info/" + threadRegex.Matches(thread)[0].Value.Replace("\"", ""); ThreadPool.QueueUserWorkItem(new ThzSgDl().work, new AsynObj(path, link)); } } catch (Exception e) { Config1.appendFile(o.Url, Path.Combine(o.Path, "failList.txt")); } }
public void work(Object obj) { AsynObj asycObj = (AsynObj)obj; try { HttpWebRequest downloadParam = (HttpWebRequest)WebRequest.Create(Config1.EMPTY_URL); downloadParam.Host = "www.akiba-online.com"; string content = NewDlTool.GetHtml(asycObj.Url, true, downloadParam); string name = nameRegex.Match(content).Value.Replace("<title>", "").Replace("</title>", ""); string path = Path.Combine(asycObj.Path, Config1.ValidePath(name) + ".htm"); MatchCollection mc = torrentRegex.Matches(content); ArrayList list = new ArrayList(); foreach (Match match in mc) { string torrentLink = ""; if (match.Value.Contains("torrent")) { torrentLink = "https://www.akiba-online.com/" + match.Value.Replace("<a href=\"", "").Replace("\" target=\"_blank\">", ""); list.Add(torrentLink); } } path = Config1.InvalidPathFilter(path); foreach (string link in list) { NewDlTool.downLoadFile(link, path + ".torrent", true, downloadParam); } DlTool.SaveFile(content, path); }catch (Exception e) { Console.WriteLine(e.Message + " " + asycObj.Url); Config1.appendFile(asycObj.Url, "d:\\test\\failList.txt"); } }