shiyouroc 发表于 2022-7-18 17:44:06

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)

python爱好者. 发表于 2022-7-18 17:57:09

求助?

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

python爱好者. 发表于 2022-7-18 17:57
求助?

没报错

临时号 发表于 2022-7-18 19:34:25

rom 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)

shiyouroc 发表于 2022-7-18 19:57:03

临时号 发表于 2022-7-18 19:34


问问有什么不用吗

临时号 发表于 2022-7-18 19:58:20

shiyouroc 发表于 2022-7-18 19:57
问问有什么不用吗

data['type']: 'http'
data['ipPort']: '47.105.91.226:8118'
改成=

shiyouroc 发表于 2022-7-18 19:59:58

临时号 发表于 2022-7-18 19:58
data['type']: 'http'
data['ipPort']: '47.105.91.226:8118'
改成=

shiyouroc 发表于 2022-7-18 20:01:23

临时号 发表于 2022-7-18 19:58
data['type']: 'http'
data['ipPort']: '47.105.91.226:8118'
改成=

明天我试试试
页: [1]
查看完整版本: python 爬虫求助