python爬虫求助
这个网站可以https://www.juliangip.com/agent可以大规模检测ip
我变了一个爬虫但效果不尽人意。
from urllib.request import *
from urllib.parse import *
url = 'https://www.juliangip.com/checkAgent'
data = {}
data['type']: 'http'
data['ipPort']: '47.105.91.226:8118'
head = {}
head['user-agent'] = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.39 Safari/537.36 Edg/104.0.1293.21'
data = urlencode(data).encode('utf-8')
req = Request(url,data,head)
xx = urlopen(req)
html = xx.read().decode('utf-8')
print(html)
what's your purpose? from urllib.request import *
from urllib.parse import *
url = 'https://www.juliangip.com/checkAgent'
data = {}
data['type'] = 'http'
data['ipPort'] = '47.105.91.226:8118'
head = {}
head['user-agent'] = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.39 Safari/537.36 Edg/104.0.1293.21'
data = urlencode(data).encode('utf-8')
req = Request(url,data,head)
xx = urlopen(req)
html = xx.read().decode('utf-8')
print(html)
页:
[1]