透過介面拿到代理,返回代理列表(只有http,無https)

我爱你的發表於2024-06-09
def get_proxies_list(num):
res = requests.get(url = f"http://api.89ip.cn/tqdl.html?api=1&num={num*2}&port=&address=&isp=").text

ip_list = re.compile("<br>(.*?)<br>").findall(res)

proxies_list = []
for i in ip_list:
ip = {
"http": i
}
proxies_list.append(ip)
# print(len(proxies_list))
return proxies_list

"""返回內容如下 num代表你需要的代理數量

[{'http': '111.225.153.81:8089'}, {'http': '20.77.80.197:80'}, {'http': '89.145.162.81:3128'}, {'http': '186.125.218.236:999'}, {'http': '103.118.44.203:8080'}, {'http': '182.106.220.252:9091'}, {'http': '202.12.80.15:82'}, {'http': '159.226.227.108:80'}, {'http': '190.113.40.40:999'}, {'http': '113.121.39.222:9999'}, {'http': '103.162.205.252:8181'}, {'http': '60.174.1.149:8089'}, {'http': '139.227.214.142:3128'}, {'http': '117.69.159.208:41122'}, {'http': '178.128.156.24:443'}, {'http': '45.229.6.41:999'}, {'http': '201.184.127.109:999'}, {'http': '104.129.192.175:8800'}, {'http': '45.119.113.62:83'}, {'http': '101.37.81.87:80'}, {'http': '202.154.18.19:8080'}, {'http': '117.69.237.81:8089'}, {'http': '159.226.227.118:80'}, {'http': '36.67.186.76:8080'}, {'http': '45.178.52.18:999'}, {'http': '117.71.149.164:8089'}, {'http': '203.34.28.50:80'}, {'http': '45.12.31.133:80'}, {'http': '117.69.236.127:8089'}, {'http': '103.53.77.254:28080'}]"""

相關文章