Skip to content

Commit

Permalink
'修改代理ip'
Browse files Browse the repository at this point in the history
  • Loading branch information
cuizhongyi committed Jun 22, 2020
1 parent 10caa5e commit a634efe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 抓取IP地址/get_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def check_ip(self, ip_info):
proxies = {'http': 'http://' + ip_url, 'https': 'https://' + ip_url}
res = False
try:
request = requests.get(url=self.check_url, headers=self.header, proxies=proxies, timeout=5)
request = requests.get(url=self.check_url, headers=self.header, proxies=proxies, timeout=3)
if request.status_code == 200:
res = True
except Exception as error_info:
Expand All @@ -60,7 +60,7 @@ def run(self):
ip_type = td_list[5].get_text()
info = {'ip': ip_address, 'port': ip_port, 'type': ip_type}
# 先校验一下IP的有效性再存储
check_res = self.check_ip(info);
check_res = self.check_ip(info)
if check_res:
print('IP有效:', info)
self.json_data.append(info)
Expand Down
1 change: 1 addition & 0 deletions 抓取IP地址/ip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"ip": "223.241.5.139", "port": "4216", "type": "HTTPS"}, {"ip": "58.220.95.35", "port": "10174", "type": "HTTP"}, {"ip": "58.220.95.30", "port": "10174", "type": "HTTP"}, {"ip": "36.250.156.73", "port": "9999", "type": "HTTPS"}, {"ip": "1.198.72.253", "port": "9999", "type": "HTTP"}]
1 change: 1 addition & 0 deletions 抓取IP地址/ip1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"ip": "223.241.5.139", "port": "4216", "type": "HTTPS"}, {"ip": "58.220.95.35", "port": "10174", "type": "HTTP"}, {"ip": "58.220.95.30", "port": "10174", "type": "HTTP"}, {"ip": "36.250.156.73", "port": "9999", "type": "HTTPS"}, {"ip": "1.198.72.253", "port": "9999", "type": "HTTP"}]

0 comments on commit a634efe

Please sign in to comment.