shiyouroc 发表于 2022-7-18 17:35:16

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)

suchocolate 发表于 2022-7-19 08:42:39

what's your purpose?

临时号 发表于 2022-7-19 11:40:54

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]
查看完整版本: python爬虫求助