add Google-free translate failed warnning

This commit is contained in:
lededev
2021-09-25 19:31:53 +08:00
parent 37869f58e7
commit 0ca57fa8c1

View File

@@ -467,6 +467,9 @@ def translate(
+ src + src
) )
result = get_html(url=url, return_type="object") result = get_html(url=url, return_type="object")
if not result.ok:
print('[-]Google-free translate web API calling failed.')
return ''
translate_list = [i["trans"] for i in result.json()["sentences"]] translate_list = [i["trans"] for i in result.json()["sentences"]]
trans_result = trans_result.join(translate_list) trans_result = trans_result.join(translate_list)