|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- import urllib.request
- import random
- url = 'http://www.whatismyip.com.tw'
- iplist = ["61.135.217.7:80","122.72.32.88:80","114.223.173.24:8118",'122.72.32.74:80']
- proxy_support = urllib.request.ProxyHandler({"HTTP":random.choice(iplist)})
- opener = urllib.request.build_opener(proxy_support)
- opener.addheaders = [("User-Agent","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0")]
- urllib.request.install_opener(opener)
- response = urllib.request.urlopen(url)
- html = response.read().decode("utf-8")
- print(html)
复制代码
根据视频自己敲的,问题是显示不出代理ip,显示的是我的ip,在网上找了好多高匿ip都是这样
- <body>
- <h1>IP位址</h1> <span data-ip='139.214.251.23'><b style='font-size: 1.5em;'>139.214.251.23</b></span> <span data-ip-country='CN'><i>CN</i></span>
- <script type="application/json" id="ip-json">
- {
- "ip": "139.214.251.234",
- "ip-country": "CN",
- "ip-real": "",
- "ip-real-country": ""
- }
- </script>
复制代码
这是运行结果的一部分,这个139.214.251.23是我的ip啊,大神们,这个问题怎么解决呢
|
|