爬百度翻译

import requests
import json

headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/88.0.4324.146 Safari/537.36'
}
url = 'https://fanyi.baidu.com/sug'
query = input("请输入需要翻译的内容")
data = {
'kw': query
}
response = requests.post(url=url, headers=headers, data=data)
dic_obj = response.json()
print(dic_obj)

非常奇怪,这个url在抓包工具里看不到,奇怪了
posted @ 2021-11-30 17:13  理工—王栋轩  阅读(40)  评论(0编辑  收藏  举报