fix translate output

This commit is contained in:
iou1name 2020-03-12 20:14:08 -04:00
parent 382b3ce179
commit ffe7537de7

View File

@ -25,11 +25,12 @@ def translate(text, in_lang='auto', out_lang='en'):
"q": text,
}
url = "http://translate.googleapis.com/translate_a/single"
res = requests.get(url, params=query, timeout=40, headers=headers,
verify=True)
res = requests.get(url, params=query, timeout=40, headers=headers)
res.raise_for_status()
data = res.json()
return data[0][0][0], data[2]
tl_text = [item[0] for item in data[0]]
tl_text = ''.join(tl_text)
return tl_text, data[2]
@commands('translate', 'tr')