示例#1
0
        public void RunAsyncAndContiune()
        {
            if (Environment.GetEnvironmentVariable("TRAVIS") == "1")
            {
                return;
            }
            Spider spider = Spider.Create(new TestPageProcessor()).AddPipeline(new TestPipeline());

            spider.ThreadNum    = 1;
            spider.EncodingName = "UTF-8";
            for (int i = 0; i < 10000; i++)
            {
                spider.AddRequests("http://www.baidu.com/" + i);
            }
            spider.RunAsync();
            Thread.Sleep(5000);
            spider.Pause(() =>
            {
                spider.Continue();
            });
            Thread.Sleep(5000);
        }