免费在线代理的刮刀
getproxies的Python项目详细描述
获取代理
从免费代理源获取一些免费代理。在
fromgetproxiesimportget_proxiesproxies=get_proxies()print(proxies[:10])# [http://196.18.215.153:3128, https://36.67.89.179:65205, http://35.247.192.53:3128, socks5://113.54.158.40:1080, https://180.122.51.154:9999, socks4://117.44.28.152:9201, https://178.20.137.178:43980, https://109.86.121.118:46333, https://148.77.34.194:39175, socks4://114.99.16.195:1080]
或使用cli:
^{pr2}$安装
$ pip install getproxies
or for latest code
$ pip install -U git+https://github.com/granitosaurus/getproxies
来源
目前支持这些源
source | spider |
---|---|
http://free-proxy-list.net | FreeProxyListSpider |
http://proxy-daily.com | ProxyDailySpider |
扩展使用
对于更详细的代理查询,可以使用ProxyManager
:
fromgetproxiesimportProxyManagerproxies=ProxyManager(limit=10,# only 10 proxiesprotocol='socks5',# only socks5 proxiescountry='us',# only us proxies)
limit参数可以减少检索时间
Proxy
对象也具有扩展属性:
classProxy:host:strport:strprotocol:strcode:str=''country:str=''anonymous:bool=Falsesource:str=''
作为字符串,它们解析为protocol://host:port
模板。在
- 项目
标签: