Example #1
0
        void work(Object obj)
        {
            AsynObj asycObj = (AsynObj)obj;
            string  content = DownloadTool.GetHtml(asycObj.Url, true, Common.CreateHttpWebRequest(asycObj.Url));

            DlTool.SaveFile(content, asycObj.Path);
            MatchCollection torrentMatch = torrentLinkRegex.Matches(content);

            if (torrentMatch.Count > 0)
            {
                string[] strs           = torrentMatch[torrentMatch.Count - 1].Value.Split('"');
                string   url            = "http://taohuabt.info/" + strs[0].Replace("&amp", "");
                string   torrentContent = DownloadTool.GetHtml(url, true, Common.CreateHttpWebRequest(url));
                DlTool.SaveFile(torrentContent, asycObj.Path + ".htm");
            }
            else
            {
                Console.WriteLine("没有匹配 " + asycObj.Url);
            }
        }
Example #2
0
        public override void Download(object obj)
        {
            AsynObj o = (AsynObj)obj;


            string content = DownloadTool.GetHtml(o.Url, true, Common.CreateHttpWebRequest(o.Url));

            if (content != "")
            {
                //string[] contents = content.Split(new string[] { "<td align=\"center\">" }, StringSplitOptions.RemoveEmptyEntries);
                //content = contents[1];
                if (o.Path != null)
                {
                    DlTool.SaveFile(content, Path.Combine(o.Path, DlTool.ReplaceUrl(o.Url)) + ".htm");
                }
                ISinglePageDonwloader sgDl = new ThzSgDl();
                AsynObj asynObj            = new AsynObj();
                asynObj.Path    = o.Path;
                asynObj.Content = content;
                ThreadPool.QueueUserWorkItem(sgDl.Download, asynObj);
            }
        }