|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package us.codecraft.webmagic.proxy;
|
|
|
|
|
|
|
|
|
|
import us.codecraft.webmagic.Page;
|
|
|
|
|
import us.codecraft.webmagic.Request;
|
|
|
|
|
import us.codecraft.webmagic.Task;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -23,7 +24,23 @@ public interface ProxyProvider {
|
|
|
|
|
* Get a proxy for task by some strategy.
|
|
|
|
|
* @param task the download task
|
|
|
|
|
* @return proxy
|
|
|
|
|
* @deprecated Use {@link #getProxy(Request, Task)} instead.
|
|
|
|
|
*/
|
|
|
|
|
Proxy getProxy(Task task);
|
|
|
|
|
@Deprecated
|
|
|
|
|
default Proxy getProxy(Task task) {
|
|
|
|
|
throw new UnsupportedOperationException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a proxy for the request.
|
|
|
|
|
*
|
|
|
|
|
* @param request the request
|
|
|
|
|
* @param task the download task
|
|
|
|
|
* @return proxy
|
|
|
|
|
* @since 0.9.0
|
|
|
|
|
*/
|
|
|
|
|
default Proxy getProxy(Request request, Task task) {
|
|
|
|
|
return this.getProxy(task);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|