mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
issues/642
Update vndb.py
This commit is contained in:
parent
cfbc76f20b
commit
12ee2d5649
@ -75,16 +75,17 @@ def vndbdowloadinfo(vid):
|
||||
|
||||
def safegetvndbjson(url, json, getter):
|
||||
try:
|
||||
print(url, json)
|
||||
_ = requests.post(
|
||||
url,
|
||||
json=json,
|
||||
proxies=getproxy(),
|
||||
)
|
||||
print(_.text)
|
||||
try:
|
||||
return getter(_.json())
|
||||
except:
|
||||
# print_exc()
|
||||
print(_.text)
|
||||
return None
|
||||
except:
|
||||
return None
|
||||
|
22
LunaTranslator/LunaTranslator/translator/sugoionline.py
Normal file
22
LunaTranslator/LunaTranslator/translator/sugoionline.py
Normal file
@ -0,0 +1,22 @@
|
||||
from translator.basetranslator import basetrans
|
||||
|
||||
|
||||
class TS(basetrans):
|
||||
def langmap(self):
|
||||
return {"en": "English", "ja": "Japanese", "zh": "Chinese", "vi": "Vietnamese"}
|
||||
|
||||
def translate(self, query):
|
||||
|
||||
json_data = {
|
||||
"content": {
|
||||
"input_text": query,
|
||||
"input_language": self.srclang,
|
||||
"output_language": self.tgtlang,
|
||||
},
|
||||
"message": "translate sentences",
|
||||
}
|
||||
|
||||
response = self.session.post(
|
||||
"https://translation-server-proxy-7ja5f.ondigitalocean.app/", json=json_data
|
||||
)
|
||||
return response.json()[0]
|
@ -948,6 +948,12 @@
|
||||
"color": "#1839f0",
|
||||
"name": "Sugoi"
|
||||
},
|
||||
"sugoionline": {
|
||||
"use": true,
|
||||
"color": "#1839f0",
|
||||
"name": "Sugoi",
|
||||
"useproxy": true
|
||||
},
|
||||
"kingsoft": {
|
||||
"type": "offline",
|
||||
"use": false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user