赞
踩
显而易见,每次输入词语,就会发送post请求,返回的json数据也十分简单
# 复制url,记得去掉'_o' url = 'http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule' # 构造请求头 headers = { 'User - Agent': 'Mozilla / 5.0(Windows NT 10.0;Win64;x64) AppleWebKit / 537.36(KHTML, likeGecko) Chrome / 72.0.3626.121Safari / 537.36', 'Host': 'fanyi.youdao.com' } # 构造请求参数 parameter = { 'i': content, 'from': 'zh-CHS', 'to': 'zh-CHS', 'smartresult': 'dict', 'client': 'fanyideskweb', 'salt': '15519651381700', 'sign': '6e08c6764da13606b9fce21863bfc064', 'ts': '1551965138170', 'bv': '33a62fdcf6913d2da91495dad54778d1', 'doctype': 'json', 'version': '2.1', 'keyfrom': 'fanyi.web', 'action': 'FY_BY_REALTIME', 'typoResult': 'false' } res = requests.get(url, params=parameter, headers=headers)
end
源码上传至github:https://github.com/hrzzz/YoudaoSpider
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。