Example #1
0
        public ActionResult GetCookiePost(RequestArgs param)
        {
            ILog log = LogManager.GetLogger("cookielog");

            CookieRequester.PostRequest(new CrawlSettings(), param);
            return(View());
        }
Example #2
0
        public void PostRequestTest()
        {
            CrawlSettings settings = new CrawlSettings();
            RequestArgs   args     = new RequestArgs()
            {
                PostParameters = "a=1234", RequestUri = "http://www.wqii.com.cn"
            };
            ILog log = LogManager.GetLogger("requestLogger");

            CookieRequester.PostRequest(settings, args, log);
            Assert.AreEqual(null, settings.CookieContainer);
        }
Example #3
0
        public void StartCrawl(CrawlSettings settings, RequestArgs parameters)
        {
            ILog          log       = LogManager.GetLogger("crawlLog");
            CrawlSettings settings2 = CookieRequester.PostRequest(settings, parameters);

            if (settings2.CookieContainer == null)
            {
                log.Error("Failure getting Cookies ,Crawl Suspended.");
                return;
            }
            AuthenticPageRequester authenticPageRequester = new AuthenticPageRequester(settings);
            PoliteWebCrawler       crawler = new PoliteWebCrawler(settings.CrawConfiguration, null, null, null, authenticPageRequester, null, null, null, null);

            //添加处理事件
            //....
            crawler.Crawl(new Uri(""));
        }