This commit is contained in:
恍兮惚兮 2024-11-12 18:24:12 +08:00
parent b9ad8bcbe0
commit 172f9a8e4d
3 changed files with 1 additions and 67 deletions

View File

@ -1,7 +1,7 @@
set(VERSION_MAJOR 5)
set(VERSION_MINOR 58)
set(VERSION_PATCH 2)
set(VERSION_PATCH 3)
set(VERSION_REVISION 0)
add_definitions(-DVERSION_MAJOR=${VERSION_MAJOR})
add_definitions(-DVERSION_MINOR=${VERSION_MINOR})

View File

@ -1,61 +0,0 @@
from translator.basetranslator import basetrans
class TS(basetrans):
def langmap(self):
return {"zh": "zh-CHS"}
def inittranslator(self):
headers = {
"authority": "ai.youdao.com",
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"accept-language": "zh-CN,zh;q=0.9",
"cache-control": "max-age=0",
"sec-ch-ua": '"Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "none",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36",
}
self.proxysession.get(
"https://ai.youdao.com/product-fanyi-text.s", headers=headers
)
def translate(self, content):
headers = {
"authority": "aidemo.youdao.com",
"accept": "application/json, text/javascript, */*; q=0.01",
"accept-language": "zh-CN,zh;q=0.9",
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"origin": "https://ai.youdao.com",
"referer": "https://ai.youdao.com/",
"sec-ch-ua": '"Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36",
}
data = {
"q": content,
"from": self.srclang,
"to": self.tgtlang,
}
response = self.proxysession.post(
"https://aidemo.youdao.com/trans", data=data, headers=headers
)
try:
js = response.json()["translation"][0]
return js
except:
raise Exception(response.maybejson)

View File

@ -1821,11 +1821,6 @@
"color": "blue",
"name": "有道_v3"
},
"youdao5": {
"use": false,
"color": "blue",
"name": "有道_v5"
},
"itrans": {
"use": false,
"color": "blue",