这样正常返回,但是返回也是加密的,需要AES解密,自己探索试试吧
[Python] 纯文本查看 复制代码 import requests,time,hashlib
o = int(time.time()*1000)
def sign():
# e = 'asdjnjfenknafdfsdfsd'
# u = 'fanyideskweb'
# d = 'webfanyi'
q = 'client=fanyideskweb&mysticTime='+ str(o) +'&product=webfanyi&key=fsdsogkndfokasodnaso'
a = hashlib.md5(q.encode()).hexdigest()
return a
headers = {
"Origin": "https://fanyi.youdao.com",
"Referer": "https://fanyi.youdao.com/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 Edg/118.0.2088.61",
'Host':'dict.youdao.com',
'Cookie':'OUTFOX_SEARCH_USER_ID_NCOO=1918452785.9332309; OUTFOX_SEARCH_USER_ID=714488211@171.221.146.167'
}
url = 'https://dict.youdao.com/webtranslate'
data = {
'i': '狗',
'from': 'auto',
'to': '',
'domain': 0,
'dictResult': 'true',
'keyid': 'webfanyi',
'sign': sign(),
'client': 'fanyideskweb',
'product': 'webfanyi',
'appVersion': '1.0.0',
'vendor': 'web',
'pointParam': 'client,mysticTime,product',
'mysticTime': str(o),
'keyfrom': 'fanyi.web',
'mid': 1,
'screen': 1,
'model': 1,
'network': 'wifi',
'abtest': 0,
'yduuid': 'abcdefg'
}
res = requests.post(url,data=data,headers=headers)
print(res.text) |