马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import urllib.request
import urllib.parse
content = input('请输入要翻译的内容:')
url = 'http://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule'
date = {}
date['i']=content
date['from']='AUTO'
date['to']='AUTO'
date['smartresult']='dict'
date['client']='fanyideskweb'
date['salt']='15979913254708'
date['sign']='fe5f00b4f6da188ae071a5f15f239354'
date['lts']='1597991325470'
date['bv']='cc652a2ad669c22da983a705e3bca726'
date['doctype']='json'
date['version']='2.1'
date['keyfrom']='fanyi.web'
date['action']='FY_BY_CLICKBUTTION'
date = urllib.parse.urlencode(date).encode('utf-8')
response = urllib.request.urlopen(url,date)
html = response.read()
print(html)
爬出来结果:请输入要翻译的内容:我爱你
b'{"errorCode":50}'
>>>
这是有道搞得鬼吗
|