最近需要用到在线翻译,就找了一个初期免费(送100初始资金)的站,而且有道这个网站主要就是做翻译的,质量应该还是信得过
请求示例:
import random, string, config
def randomword(length):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(length))
appSecret=config.appSecret
q="<待翻译文本>"
from="en"
to="zh-CHS"
appKey=config.appKey
salt=randomword(<任意长度>)
sign=md5(appKey+q+salt+appSecret) #格式要求:%32X
返回示例
{
"tSpeakUrl": "",
"web": [
{
"value": [
"lunar eclipse",
"Eclipse",
"moon's eclipse"
],
"key": "月食"
},
{
"value": [
"penumbral lunar eclipse",
"penumbral eclipse",
"appulse"
],
"key": "半影月食"
},
{
"value": [
"moon phases"
],
"key": "月食字体"
}
],
"query": "月食",
"translation": [
"Eclipse of the moon"
],
"errorCode": "0",
"dict": {
"url": "yddict://m.youdao.com/dict?le=eng&q=%E6%9C%88%E9%A3%9F"
},
"webdict": {
"url": "http://m.youdao.com/dict?le=eng&q=%E6%9C%88%E9%A3%9F"
},
"basic": {
"phonetic": "yuè shí",
"explains": [
"[天] eclipse of the moon",
"[天] lunar eclipse"
]
},
"l": "zh-CHS2en",
"speakUrl": ""
}