生成免费、可靠的http(s)代理列表。
grey_harvest的Python项目详细描述
灰色收获
为可靠的HTTP/HTTPS代理擦除Web并测试它们。 速度和可靠性。可以同时用作python模块和 命令行实用程序当作为命令行实用程序运行时,代理服务器 被送到标准输出。当作为模块运行时,它返回一个生成器。
在https://pypi.python.org/pypi/grey_harvest/0.1.3.5查看pypi上的项目
主要功能
- 可用作comannd行实用程序或python模块
- 可以对支持SSL 的代理进行过滤
安装
首先,安装以下依赖项:
# On Centos/RHEL/Fedora: sudo yum install python-devel libxlt-devel libxml-devel # On Debian/Ubuntu: sudo apt-get install python-dev libxml2-dev libxslt1-dev
然后使用PIP安装Grey_Harvest,如下所示:
pip install grey_harvest
使用量
我们可以用以下命令生成10个可行代理的列表:
# use the -n flag to specify number of proxies to generate grey_harvest -n 10
仅选择启用SSL的代理,我们这样做:
# use the -H flag to select only https proxies grey_harvest -n 10 -H
我们可以使用-A标志来过滤位于A内的代理 具体国家名单。例如,选择代理的位置 在乌克兰、香港和美国,我们会用这个词:
# use the -a flag to filter by country grey_harvest -a "United States" "Hong Kong" Ukraine -n 10
我们可以使用-p标志筛选在特定端口上运行的端口:
# the -p flag to only use proxies that run on port 80 grey_harvest -p 80 -n 10我们可以通过使用特定的国家来拒绝代理。 D旗。中国内部的代理被默认封锁 因为它们通常位于防火墙后面,因此 往往不可靠这可以在Grey_Harvest.py的 内部配置:
# use the -d flag to deny proxies located within France and # Germany grey_harvest -d France Germany -n 10 -H
灰色收获库-基本示例
在进入Grey_Harvest图书馆的文档之前, 看看我们能容易地生成20个代理的列表:
import gray_harvest ''' spawn a harvester ''' harvester = grey_harvest.GreyHarvester() ''' harvest some proxies from teh interwebz ''' count = 0 for proxy in harvester.run(): print proxy count += 1 if count >= 20: break
就这样。我们现在有20个HTTP/HTTPS代理准备好了。
历史
0.1.5(2016-04-20)
- 修复了指定自定义测试域时出现的连接错误
0.1.4(2016-04-19)
0.1.3(2015-05-26)
- 添加文档
0.1.2(2015-05-26)
- 更正了一些生成问题
0.1.0(2015-05-26)
- 初次发行
学分
“灰嫒收获”是由加布里埃尔's0lst1c3'ryan编写和维护的。
贡献者
当您提交第一个请求时,请按字母顺序添加您自己。