Commit b871b210 authored by yihua.huang's avatar yihua.huang

Merge branch 'proxy-strategy' of github.com:EdwardsBean/webmagic into EdwardsBean-proxy-strategy

parents b5413368 19474e47
...@@ -5,6 +5,7 @@ import com.google.common.collect.Table; ...@@ -5,6 +5,7 @@ import com.google.common.collect.Table;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import us.codecraft.webmagic.proxy.Proxy; import us.codecraft.webmagic.proxy.Proxy;
import us.codecraft.webmagic.proxy.SimpleProxyPool;
import us.codecraft.webmagic.proxy.ProxyPool; import us.codecraft.webmagic.proxy.ProxyPool;
import us.codecraft.webmagic.utils.UrlUtils; import us.codecraft.webmagic.utils.UrlUtils;
...@@ -470,18 +471,18 @@ public class Site { ...@@ -470,18 +471,18 @@ public class Site {
* @param httpProxyList httpProxyList * @param httpProxyList httpProxyList
* @return this * @return this
*/ */
public Site setHttpProxyPool(List<String[]> httpProxyList) { public Site setHttpProxyPool(ProxyPool proxyPool) {
this.httpProxyPool=new ProxyPool(httpProxyList); this.httpProxyPool = proxyPool;
return this; return this;
} }
public Site setHttpProxyPool(List<String[]> httpProxyList, boolean isUseLastProxy) { public Site setHttpProxyPool(List<String[]> httpProxyList, boolean isUseLastProxy) {
this.httpProxyPool=new ProxyPool(httpProxyList, isUseLastProxy); this.httpProxyPool=new SimpleProxyPool(httpProxyList, isUseLastProxy);
return this; return this;
} }
public Site enableHttpProxyPool() { public Site enableHttpProxyPool() {
this.httpProxyPool=new ProxyPool(); this.httpProxyPool=new SimpleProxyPool();
return this; return this;
} }
...@@ -497,9 +498,4 @@ public class Site { ...@@ -497,9 +498,4 @@ public class Site {
httpProxyPool.returnProxy(proxy,statusCode); httpProxyPool.returnProxy(proxy,statusCode);
} }
public Site setProxyReuseInterval(int reuseInterval) {
this.httpProxyPool.setReuseInterval(reuseInterval);
return this;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment