issues/642

Update vndb.py
This commit is contained in:
恍兮惚兮 2024-04-11 12:29:02 +08:00
parent cfbc76f20b
commit 12ee2d5649
3 changed files with 30 additions and 1 deletions

View File

@ -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

View 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]

View File

@ -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,