从internet获取可用代理的Python包

hideme的Python项目详细描述


隐藏名Python BadgeBuild Status

HideMe是一个python包,用于从免费代理网站收集可用的代理 可通过pip安装,如下所示。在

pip install hideme

文件

HideMe返回的代理的格式如下

^{pr2}$

你可以得到如下所示的代理

fromhideme.proxy_collectorimportProxiesListproxy_list=ProxiesList()proxy=proxy_list.get()

输出:

[{"ip_address":"88.198.50.103","port":"8080","country_code":"DE","country":"Germany","anonymity":"anonymous","google_support":False,"https":False}]

通过向get方法传递count param,可以获得所需数量的代理。在

fromhideme.proxy_collectorimportProxiesListproxies_list=ProxiesList()proxies=proxies_list.get(count=2)

输出:

[{"ip_address":"88.198.50.103","port":"8080","country_code":"DE","country":"Germany","anonymity":"anonymous","google_support":False,"https":False},{"ip_address":"187.45.123.137","port":"36559","country_code":"BR","country":"Brazil","anonymity":"elite proxy","google_support":False,"https":True}]

您还可以通过将filter参数传递给ProxiesList类来过滤返回的代理。例子用法:在

这将只返回位于Country-Spain

fromhideme.proxy_collectorimportProxiesListproxies_list=ProxiesList(country='Spain')proxies=proxies_list.get()

输出:

[{"ip_address":"185.44.232.30","port":"53281","country_code":"ES","country":"Spain","anonymity":"elite proxy","google_support":False,"https":False},{"ip_address":"82.223.3.52","port":"8118","country_code":"ES","country":"Spain","anonymity":"elite proxy","google_support":False,"https":False}]

这将只返回那些支持HTTPS的代理

fromhideme.proxy_collectorimportProxiesListproxies_list=ProxiesList(https=True)proxies=proxies_list.get()

输出

[{"ip_address":"201.217.4.101","port":"53281","country_code":"PY","country":"Paraguay","anonymity":"elite proxy","google_support":False,"https":True},{"ip_address":"13.233.160.59","port":"80","country_code":"IN","country":"India","anonymity":"elite proxy","google_support":False,"https":True}]

您也可以像下面这样组合多个过滤器参数

fromhideme.proxy_collectorimportProxiesListproxies_list=ProxiesList(country='India',https=True,port='80',google_support=False)proxies=proxies_list.get()

输出

[{"ip_address":"13.233.160.59","port":"80","country_code":"IN","country":"India","anonymity":"elite proxy","google_support":False,"https":True}]

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Detect可以使用HTTP请求访问url   Java可访问翻译web服务?   来自Eclipse应用程序的java工作区   java Android映像未存储在存储器中   在R中读取xlsx文件后出现java获取错误   在Apache Tomcat中进行部署时,java Eureka客户端连接超时   Java中的置换问题/错误旅行商问题的最近邻算法的实现   java编程一个计算器,它按DMAS顺序执行操作   java无法访问findByDescriptionContaining(字符串描述)的lob流   java如何在春季用@ComponentScan惰性地加载所有bean?   连接到删除主机时java apache FTP客户端连接超时   用java将非整数日转换为实际日期?   C++ MMAP()与java MaPDyByTeffFor性能?   java后缀Trie匹配,匹配操作出现问题