从国外的代理IP网站提取代理IP, 100%可用!!!
py代码:
# -*- coding:utf-8 -*-
import requests
import re
import execjs
ti = """请选择提取的数量:
0.30个代理IP
1.50个代理IP
2.100个代理IP
3.200个代理IP
4.300个代理IP
5.500个代理IP
请输入你要提取数量的编号>>> """
while True:
shu = input(ti)
if shu not in ['0', '1', '2', '3', '4', '5']:
print("\n\033[31m%s\033[0m" % "输入有误,请重新输入!\n")
else:
break
url = "http://spys.one/en/http-proxy-list/" # 该网站为国外网站,需要设置代理才访问
data = {
'xf1': "0",
'xf2': "0",
'xf4': "0",
'xf5': "0",
'xpp': str(shu),
}
# xpp:4代表提取300个代理;0:30,1:50,2:100,3:200,4:300,5:500
print("正在获取代理网站内容...")
try:
h1 = requests.post(url=url, data=data)
except requests.exceptions.ConnectionError:
exit("注意: 需要设置国外代理才能提取!")
if h1.status_code == 200:
print("获取成功!\n\n正在解密代理IP...")
else:
exit("获取失败!")
hh = h1.text
ip = re.findall("\d{2