Search in sources :

Example 1 with ProxyBindRoutPlanner

use of com.virjar.dungproxy.client.httpclient.conn.ProxyBindRoutPlanner in project vscrawler by virjar.

the class CrawlerSession method decorateRoutePlanner.

private void decorateRoutePlanner(CrawlerHttpClient crawlerHttpClient) {
    HttpRoutePlanner routePlanner = crawlerHttpClient.getRoutePlanner();
    if (!(routePlanner instanceof ProxyBindRoutPlanner)) {
        log.warn("自定义了代理发生器,vscrawler的代理功能将不会生效");
        return;
    }
    VSCrawlerRoutePlanner vsCrawlerRoutePlanner = new VSCrawlerRoutePlanner((ProxyBindRoutPlanner) routePlanner, ipPool, proxyPlanner, this);
    crawlerHttpClient.setRoutePlanner(vsCrawlerRoutePlanner);
}
Also used : VSCrawlerRoutePlanner(com.virjar.vscrawler.core.net.proxy.VSCrawlerRoutePlanner) HttpRoutePlanner(org.apache.http.conn.routing.HttpRoutePlanner) ProxyBindRoutPlanner(com.virjar.dungproxy.client.httpclient.conn.ProxyBindRoutPlanner)

Aggregations

ProxyBindRoutPlanner (com.virjar.dungproxy.client.httpclient.conn.ProxyBindRoutPlanner)1 VSCrawlerRoutePlanner (com.virjar.vscrawler.core.net.proxy.VSCrawlerRoutePlanner)1 HttpRoutePlanner (org.apache.http.conn.routing.HttpRoutePlanner)1