void work(Object obj) { AsynObj asycObj = (AsynObj)obj; HttpWebRequest downloadParam = (HttpWebRequest)WebRequest.Create(Config1.EMPTY_URL); downloadParam.Host = "www.akiba-online.com"; string content = NewDlTool.GetHtml(asycObj.Url, true, downloadParam); DlTool.SaveFile(content, asycObj.Path); string gid = gidRegex.Match(content).Value.Replace("var gid = ", "").Replace(";", ""); string img = imgRegex.Match(content).Value.Replace("var img = '", "").Replace("';", ""); string link = "https://www.javbus.com/ajax/uncledatoolsbyajax.php?gid=" + gid + "&lang=zh&img=" + img + "&uc=0&floor=900"; string magnetContent = NewDlTool.GetHtml(link, true, downloadParam); DlTool.SaveFile(magnetContent, asycObj.Path + "_magenet"); }
public override void Download(object obj) { AsynObj o = (AsynObj)obj; HttpWebRequest downloadParam = (HttpWebRequest)WebRequest.Create(Config1.EMPTY_URL); downloadParam.Host = "www.akiba-online.com"; string content = NewDlTool.GetHtml(o.Url, true, downloadParam); if (content != "") { if (o.Path != null) { DlTool.SaveFile(content, Path.Combine(o.Path, DlTool.ReplaceUrl(o.Url)) + ".htm"); } AkibaOnlineSgDl sgDl = new AkibaOnlineSgDl(); AsynObj asynObj = new AsynObj(); asynObj.Path = o.Path; asynObj.Content = content; ThreadPool.QueueUserWorkItem(sgDl.Download, asynObj); } }
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"); } }