import requests
from lxml import etree
url = ‘https://www.kuaidaili.com/free/inha/{}/’
headers = {‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:70.0) Gecko/20100101 Firefox/70.0’}
response = requests.get(url.format(1),headers=headers).text
text = etree.HTML(response)
ips = text.xpath(’//[@id=“list”]/table/tbody/tr/td[1]/text()’)
ports = text.xpath(’//[@id=“list”]/table/tbody/tr/td[2]/text()’)
print(ips,ports)
results =zip(ips,ports)
for i in results:
ip = ‘{}:{}’.format(i[0],i[1])
print(ip)
获取免费代理IP
最新推荐文章于 2024-08-15 15:27:27 发布