the ip,API link obtained using the API of an open source project is API here . To check whether it is available, I used the obtained ip to visit the ip query website
. however, I found that the ip I queried has not changed
here is my code
Please take a look at
import requests
from lxml import etree
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36"
}
url = "https://ip.cn/"
-sharp ipAPI
ip_url = "http://proxy.w2n1ck.com:9090/random"
ip = {"http" : "http://"+requests.get(ip_url).text}
print(ip)
response = requests.get(url, headers=headers, proxies=ip, timeout=10).text
html = etree.HTML(response)
-sharp ip
res = html.xpath("//*[@id="result"]/div/p[1]/code/text()")
print(res)