Skip to content

Commit dc67457

Browse files
committed
update readme
1 parent f64b41c commit dc67457

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
### Docker
2020

21-
如果使用 Docker,则需要安装了如下环境
21+
如果使用 Docker,则需要安装如下环境
2222

2323
* Docker
2424
* Docker-Compose
@@ -27,7 +27,7 @@
2727

2828
常规方式要求有 Python 环境、Redis 环境,具体要求如下:
2929

30-
* Python: >=3.6
30+
* Python>=3.6
3131
* Redis
3232

3333
## Docker 运行
@@ -89,7 +89,10 @@ export REDIS_CONNECTION_STRING='redis://[password]@host:port'
8989

9090
### 安装依赖包
9191

92-
这里强烈推荐使用 Conda 或 VirtualEnv 创建虚拟环境,然后 pip 安装依赖即可:
92+
这里强烈推荐使用 [Conda](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands)
93+
[virtualenv](https://virtualenv.pypa.io/en/latest/user_guide.html) 创建虚拟环境,Python 版本不低于 3.6。
94+
95+
然后 pip 安装依赖即可:
9396

9497
```shell script
9598
pip3 install -r requirements.txt
@@ -121,7 +124,7 @@ python3 run.py --processor server
121124

122125
成功运行之后可以通过 [http://localhost:5555/random](http://localhost:5555/random) 获取一个随机可用代理。
123126

124-
可以用程序对接实现,简单的示例展示了获取代理并爬取网页的过程
127+
可以用程序对接实现,下面的示例展示了获取代理并爬取网页的过程
125128

126129
```python
127130
import requests
@@ -233,7 +236,7 @@ export REDIS_KEY=proxies:weibo
233236

234237
如果使用 Docker-Compose 启动代理池,则需要在 docker-compose.yml 文件里面指定环境变量,如:
235238

236-
```shell script
239+
```yaml
237240
version: '3'
238241
services:
239242
redis:
@@ -256,9 +259,9 @@ services:
256259
REDIS_KEY: proxies:weibo
257260
```
258261
259-
## 扩展代理
262+
## 扩展代理爬虫
260263
261-
代理的爬虫均放置在 proxypool/crawlers 文件夹下,目前对接了有限的爬虫
264+
代理的爬虫均放置在 proxypool/crawlers 文件夹下,目前对接了有限几个代理的爬虫
262265
263266
若扩展一个爬虫,只需要在 crawlers 文件夹下新建一个 Python 文件声明一个 Class 即可。
264267

proxypool/crawlers/daili66.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
BASE_URL = 'http://www.664ip.cn/{page}.html'
77
MAX_PAGE = 5
88

9+
910
class Daili66Crawler(BaseCrawler):
1011
"""
1112
daili66 crawler, http://www.66ip.cn/1.html
1213
"""
1314
urls = [BASE_URL.format(page=page) for page in range(1, MAX_PAGE + 1)]
1415

15-
1616
def parse(self, html):
1717
"""
1818
parse html file to get proxies
@@ -25,6 +25,7 @@ def parse(self, html):
2525
port = int(tr.find('td:nth-child(2)').text())
2626
yield Proxy(host=host, port=port)
2727

28+
2829
if __name__ == '__main__':
2930
crawler = Daili66Crawler()
3031
for proxy in crawler.crawl():

0 commit comments

Comments
 (0)