|
|
@@ -10,9 +10,9 @@
|
|
|
|
|
|
##### [介绍文档](https://github.com/jhao104/proxy_pool/blob/master/doc/introduce.md)
|
|
|
|
|
|
-* 支持版本  
|
|
|
+* 支持版本:  
|
|
|
|
|
|
-* 测试地址: http://123.207.35.36:5010 单机勿压测。谢谢
|
|
|
+* 测试地址: http://123.207.35.36:5010 (单机勿压。感谢)
|
|
|
|
|
|
### 下载安装
|
|
|
|
|
|
@@ -67,9 +67,9 @@ port = 5010 # 监听端口
|
|
|
|
|
|
### 使用
|
|
|
|
|
|
-启动过几分钟后就能看到抓取到的代理IP,你可以直接到数据库中查看,推荐一个[SSDB可视化工具](https://github.com/jhao104/SSDBAdmin)。
|
|
|
+ 启动过几分钟后就能看到抓取到的代理IP,你可以直接到数据库中查看,推荐一个[SSDB可视化工具](https://github.com/jhao104/SSDBAdmin)。
|
|
|
|
|
|
-也可以通过api访问http://127.0.0.1:5010 查看。
|
|
|
+ 也可以通过api访问http://127.0.0.1:5010 查看。
|
|
|
|
|
|
* Api
|
|
|
|
|
|
@@ -83,7 +83,7 @@ port = 5010 # 监听端口
|
|
|
|
|
|
* 爬虫使用
|
|
|
|
|
|
-如果要在爬虫代码中使用的话, 可以将此api封装成函数直接使用,例如:
|
|
|
+ 如果要在爬虫代码中使用的话, 可以将此api封装成函数直接使用,例如:
|
|
|
|
|
|
```python
|
|
|
import requests
|
|
|
@@ -112,19 +112,59 @@ def getHtml():
|
|
|
return None
|
|
|
```
|
|
|
|
|
|
+### 扩展代理
|
|
|
+
|
|
|
+ 项目默认包含几个免费的代理获取方法,但是免费的毕竟质量不好,所以如果直接运行可能拿到的代理质量不理想。所以,提供了代理获取的扩展方法。
|
|
|
+
|
|
|
+ 添加一个新的代理获取方法如下:
|
|
|
+
|
|
|
+* 1、首先在[GetFreeProxy](https://github.com/jhao104/proxy_pool/blob/b9ccdfaada51b57cfb1bbd0c01d4258971bc8352/ProxyGetter/getFreeProxy.py#L32)类中添加你的获取代理的静态方法,
|
|
|
+该方法需要以生成器(yield)形式返回`host:ip`格式的代理,例如:
|
|
|
+
|
|
|
+```python
|
|
|
+
|
|
|
+class GetFreeProxy(object):
|
|
|
+ # ....
|
|
|
+
|
|
|
+ # 你自己的方法
|
|
|
+ @staticmethod
|
|
|
+ def freeProxyCustom(): # 命名不和已有重复即可
|
|
|
+
|
|
|
+ # 通过某网站或者某接口或某数据库获取代理 任意你喜欢的姿势都行
|
|
|
+ # 假设你拿到了一个代理列表
|
|
|
+ proxies = ["139.129.166.68:3128", "139.129.166.61:3128", ...]
|
|
|
+ for proxy in proxies:
|
|
|
+ yield proxy
|
|
|
+ # 确保每个proxy都是 host:ip正确的格式就行
|
|
|
+```
|
|
|
+
|
|
|
+* 2、添加好方法后,修改Config.ini文件中的`[ProxyGetter]`项:
|
|
|
+
|
|
|
+ 在`Config.ini`的`[ProxyGetter]`下添加自定义的方法的名字:
|
|
|
+
|
|
|
+```shell
|
|
|
+[ProxyGetter]
|
|
|
+;register the proxy getter function
|
|
|
+freeProxyFirst = 0 # 如果要取消某个方法,将其删除或赋为0即可
|
|
|
+....
|
|
|
+freeProxyCustom = 1 # 确保名字和你添加方法名字一致
|
|
|
+```
|
|
|
+
|
|
|
+ `ProxyRefreshSchedule`会每隔一段时间抓取一次代理,下次抓取时会自动识别调用你定义的方法。
|
|
|
+
|
|
|
### 问题反馈
|
|
|
|
|
|
-任何问题欢迎在[Issues](https://github.com/jhao104/proxy_pool/issues) 中反馈,如果没有账号可以去 我的[博客](http://www.spiderpy.cn/blog/message)中留言。
|
|
|
+ 任何问题欢迎在[Issues](https://github.com/jhao104/proxy_pool/issues) 中反馈,如果没有账号可以去 我的[博客](http://www.spiderpy.cn/blog/message)中留言。
|
|
|
|
|
|
-你的反馈会让此项目变得更加完美。
|
|
|
+ 你的反馈会让此项目变得更加完美。
|
|
|
|
|
|
### 贡献代码
|
|
|
|
|
|
-本项目仅作为基本的通用的代理池架构,不接收特有功能(当然,不限于特别好的idea)。
|
|
|
+ 本项目仅作为基本的通用的代理池架构,不接收特有功能(当然,不限于特别好的idea)。
|
|
|
|
|
|
-本项目依然不够完善,如果发现bug或有新的功能添加,请在[Issues](https://github.com/jhao104/proxy_pool/issues)中提交bug(或新功能)描述,在确认后提交你的代码。
|
|
|
+ 本项目依然不够完善,如果发现bug或有新的功能添加,请在[Issues](https://github.com/jhao104/proxy_pool/issues)中提交bug(或新功能)描述,在确认后提交你的代码。
|
|
|
|
|
|
-这里感谢以下contributor的无私奉献:
|
|
|
+ 这里感谢以下contributor的无私奉献:
|
|
|
|
|
|
[@kangnwh](https://github.com/kangnwh)| [@bobobo80](https://github.com/bobobo80)| [@halleywj](https://github.com/halleywj)| [@newlyedward](https://github.com/newlyedward)| [@wang-ye](https://github.com/wang-ye)| [@gladmo](https://github.com/gladmo)| [@bernieyangmh](https://github.com/bernieyangmh)| [@PythonYXY](https://github.com/PythonYXY)| [@zuijiawoniu](https://github.com/zuijiawoniu)
|
|
|
|