Exemple #1
0
        public void Run()
        {
            Spider spider = SpiderBuilder.CreateBuilder()
                            .AddRequest("https://weixin.sogou.com/").Buid();

            spider.AddPageProcessor(new Processor2());

            for (int i = 1; i <= 10; i++)
            {
                spider.AddRequest($"https://weixin.sogou.com/weixin?type=2&ie=utf8&page={i}&query=马云");
            }

            spider.NewRequestSleepInterval = 2000; // 2s
            // spider.EmptySleepTime = 60; // 60s

            spider.ThreadNumber = 5;

            //spider.UseNLog();
            spider.UseRedisScheduler("localhost");

            spider.Run();

            spider.OnStatusChanged += Spider_OnStatusChanged;

            // Console.WriteLine("end main ");
        }