public ActionResult GetCookiePost(RequestArgs param) { ILog log = LogManager.GetLogger("cookielog"); CookieRequester.PostRequest(new CrawlSettings(), param); return(View()); }
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); }
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("")); }