[Asm] 纯文本查看 复制代码 import requests
import random,time
from hashlib import md5
"""
Request Method: POST
"""
url = "https://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule"
headers = {
"Cookie": "OUTFOX_SEARCH_USER_ID=1762940805@10.169.0.84; JSESSIONID=aaaxunOVBke5jaKrl6NOx; OUTFOX_SEARCH_USER_ID_NCOO=719304890.3748397; ___rl__test__cookies=1624168728931",
"Referer": "https://fanyi.youdao.com/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36"
}
word = input("输入需要翻译的单词:")
"""
sign = n.md5("fanyideskweb" + e + i + "Tbh5E8=q6U3EXe+&L[4c@") e是自己的输入就是word
现在找i i = r + parseInt(10 * Math.random(), 10) 找r r = "" + (new Date).getTime() its=r
'salt': '16241687289334' salt = i 就是r + random.randomint(9) r是个时间戳 14位 所以 r*1000去整
"""
r=time.time()
i = str(r + random.randint(1,9))
r = str(int(r*1000))
sign ="fanyideskweb" + word + i + "Tbh5E8=q6U3EXe+&L[4c@"
md = md5() #定义一个md5对象
md.update(sign.encode()) #将字符串编码成字节格式才能进行MD5加密
res = md.hexdigest()
data = {
'i': word,
'from': 'AUTO',
'to': 'AUTO',
'smartresult': 'dict',
'client': 'fanyideskweb',
'salt': i,
'sign': res,
'lts': r,
'bv': '24ecb70ba6203e4453baed50aa26b78e',
'doctype': 'json',
'version': '2.1',
'keyfrom': 'fanyi.web',
'action': 'FY_BY_CLICKBUTTION',
}
resp = requests.post(url=url,data=data,headers=headers).json()
print(resp['translateResult']) |