ProxyBroker

https://img.shields.io/pypi/v/proxybroker.svg?style=flat-square https://img.shields.io/travis/constverum/ProxyBroker.svg?style=flat-square https://img.shields.io/pypi/wheel/proxybroker.svg?style=flat-square https://img.shields.io/pypi/pyversions/proxybroker.svg?style=flat-square https://img.shields.io/pypi/l/proxybroker.svg?style=flat-square

ProxyBroker是一个开源工具,可以从多个来源异步查找公共代理并同时检查它们。

_images / index_find_example.gif

特点

  • 查找来自约50个来源的7000多个代理服务器。
  • 支持协议:HTTP(S),SOCKS4 / 5。将CONNECT方法连接到端口80和23(SMTP)。
  • 代理可能会根据类型,匿名级别,响应时间,国家和DNSBL中的状态进行过滤。
  • 作为代理服务器,将传入请求分发给外部代理。自动代理旋转。
  • 所有代理都被检查以支持Cookies和Referer(如果需要的话,POST请求)。
  • 自动删除重复的代理。
  • 是异步的。

要求

安装

从pypi安装最新的稳定版本:

$ pip安装proxybroker

最新的开发版本可以直接从GitHub安装:

$ pip install -U git + https://github.com/constverum/ProxyBroker.git

用法

CLI示例

寻找

查找并显示来自美国的10个HTTP(S)代理,具有很高的匿名性:

$ proxybroker find --types HTTP HTTPS --lvl High --countries US --strict -l 10

_images / cli_find_example.gif

抓住

查找并保存到一个文件10个美国代理(没有支票):

$ proxybroker grab --countries US --limit 10 --outfile ./proxies.txt

_images / cli_grab_example.gif

服务

运行本地代理服务器,该服务器将传入请求分发到具有高匿名级别的已发现HTTP(S)代理池中:

$ proxybroker serve --host 127 .0.0.1 --port 8888 --types HTTP HTTPS --lvl高

_images / cli_serve_example.gif

注意

运行有关可用选项的更多信息。proxybroker --help

运行以获取有关命令的更多信息。proxybroker <command> --help

基本代码示例

查找并显示10个正常工作的HTTP(S)代理:

import asyncio
from proxybroker import Broker

async def show(proxies):
    while True:
        proxy = await proxies.get()
        if proxy is None: break
        print('Found proxy: %s' % proxy)

proxies = asyncio.Queue()
broker = Broker(proxies)
tasks = asyncio.gather(
    broker.find(types=['HTTP', 'HTTPS'], limit=10),
    show(proxies))

loop = asyncio.get_event_loop()
loop.run_until_complete(tasks)

更多例子

TODO

  • 检查ping,响应时间和数据传输速度
  • 检查网站访问权限(谷歌,推特等),甚至您自己的自定义网址
  • 正常运行时间信息
  • 返回数据的校验和
  • 支持代理验证
  • 为级联代理查找传出IP
  • 能够指定没有端口的代理的地址(尝试在默认端口上连接)

贡献

  • 把它叉起来:https//github.com/constverum/ProxyBroker/fork
  • 创建你的特性分支:git checkout -b my-new-feature
  • 提交您的更改:git commit -am’添加一些功能’
  • 推到分支:git push origin my-new-feature
  • 提交拉请求!

许可证

根据Apache许可证版本2.0获得许可

本产品包含由MaxMind创建的GeoLite2数据,可从 http://www.maxmind.com获取

zh-CN Chinese (Simplified)
X