Skip to content

一些优化 #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master'
  • Loading branch information
jy committed Oct 8, 2021
commit af1ec3c5c6a99b987aeae957f35ce5041f7ee4cb
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM python:3.6-alpine
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt -i https://pypi.douban.com/simple
# RUN pip install -r requirements.txt -i
# RUN pip install -r requirements.txt -i https://pypi.douban.com/simple
RUN apk add --no-cache libxml2-dev libxslt-dev gcc musl-dev && \
pip install -r requirements.txt && \
apk del gcc musl-dev libxml2-dev
VOLUME ["/app/proxypool/crawlers/private"]
CMD ["supervisord", "-c", "supervisord.conf"]
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
image: redis:alpine
container_name: redis4proxypool
ports:
- "6378:6379"
- "6374:6379"
# restart: always
proxypool:
build: .
Expand Down
10 changes: 5 additions & 5 deletions examples/usage2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def getChinaIP(ip='127.0.0.1'):
reader = geolite2.reader()
ip_info = reader.get(ip)
geolite2.close()
# print(ip_info)
print(ip_info)
return True if ip_info['country']['iso_code'] == 'CN' else False


Expand All @@ -32,8 +32,8 @@ def run(self):
pure_ip_address = self.proxyip.split(':')[0]
# 验证IP归属
if not getChinaIP(pure_ip_address):
pass
# raise ValueError('不是有效IP')
# pass
raise ValueError('不是有效IP')
#
start = time.time()
# 消除关闭证书验证的警告
Expand Down Expand Up @@ -88,8 +88,8 @@ def run(self):
# apiUrl = "http://127.0.0.1:5555/all"
apiUrl = "http://127.0.0.1:5555/random"
# 要抓取的目标网站地址
# targetUrl = "http://bb.cf08tp.cn/Home/index.php?m=Index&a=vote&vid=335688&id=2676&tp="
targetUrl = 'http://www.so.com'
targetUrl = "http://bb.cf08tp.cn/Home/index.php?m=Index&a=vote&vid=335688&id=2676&tp="
# targetUrl = 'http://bb.cf08tp.cn/Home/index.php?m=Index&a=vote&vid=335608&id=2676&tp='
fetchSecond = 5
# 开始自动获取IP
GetIpThread(fetchSecond).start()
4 changes: 2 additions & 2 deletions proxypool/processors/tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def run(self):
break

def run_tester():
host = '111.246.42.52'
port = '8888'
host = '96.113.165.182'
port = '3128'
tasks = [tester.test(Proxy(host=host, port=port))]
tester.loop.run_until_complete(asyncio.wait(tasks))

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ loguru==0.5.3
pyquery==1.4.3
supervisor==4.2.1
redis==3.5.3
lxml==4.6.2
lxml==4.6.3
fake_headers==1.0.2
maxminddb_geolite2==2018.703
You are viewing a condensed version of this merge commit. You can view the full changes here.