mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44: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):
|
def safegetvndbjson(url, json, getter):
|
||||||
try:
|
try:
|
||||||
|
print(url, json)
|
||||||
_ = requests.post(
|
_ = requests.post(
|
||||||
url,
|
url,
|
||||||
json=json,
|
json=json,
|
||||||
proxies=getproxy(),
|
proxies=getproxy(),
|
||||||
)
|
)
|
||||||
|
print(_.text)
|
||||||
try:
|
try:
|
||||||
return getter(_.json())
|
return getter(_.json())
|
||||||
except:
|
except:
|
||||||
# print_exc()
|
# print_exc()
|
||||||
print(_.text)
|
|
||||||
return None
|
return None
|
||||||
except:
|
except:
|
||||||
return None
|
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",
|
"color": "#1839f0",
|
||||||
"name": "Sugoi"
|
"name": "Sugoi"
|
||||||
},
|
},
|
||||||
|
"sugoionline": {
|
||||||
|
"use": true,
|
||||||
|
"color": "#1839f0",
|
||||||
|
"name": "Sugoi",
|
||||||
|
"useproxy": true
|
||||||
|
},
|
||||||
"kingsoft": {
|
"kingsoft": {
|
||||||
"type": "offline",
|
"type": "offline",
|
||||||
"use": false,
|
"use": false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user