Giter Club home page Giter Club logo

proxypool's Introduction

ProxyPool

Build Status Release

针对反爬虫问题的自动代理池组件

特色

  • 支持 Proxy 自动持久化,一次加入,永久可使用
  • 自动将不可用的 Proxy 移出代理池
  • 线程安全,支持多线程同时使用代理池
  • 优先选择响应速度快的 Proxy
  • 出现 403 等状态码时,自动降低该 Proxy 的访问频率

使用

1.添加 Maven 库

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.github.letcheng</groupId>
    <artifactId>ProxyPool</artifactId>
    <version>x.x</version>
</dependency>

2.采取 add(init) -> borrow -> reback 的方式进行使用

ProxyPool proxyPool = new ProxyPool();

proxyPool.add("203.171.230.230", 80);
proxyPool.add("121.9.221.188", 80);

HttpProxy httpProxy = proxyPool.borrow(); // 从 ProxyPool 中获取一个Proxy

proxyPool.reback(httpProxy, HttpStatus.SC_OK); // 使用完成之后,归还 Proxy,并将请求结果的 http 状态码一起传入

proxyPool.allProxyStatus();  // 可以获取 ProxyPool 中所有 Proxy 的当前状态

3.enjoy!

proxypool's People

Contributors

letcheng avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.