Use a fork of googletrans since the original isn't working
https://github.com/ssut/py-googletrans/issues/234#issuecomment-736314530
This commit is contained in:
parent
5e63e72089
commit
f30f84015a
|
@ -1,4 +1,6 @@
|
|||
googletrans
|
||||
# https://github.com/ssut/py-googletrans/issues/234#issuecomment-736314530
|
||||
git+https://github.com/alainrouillon/py-googletrans@feature/enhance-use-of-direct-api
|
||||
|
||||
pyrogram
|
||||
tgcrypto
|
||||
requests
|
||||
|
|
|
@ -39,7 +39,8 @@ async def translate(client, message):
|
|||
def _translate():
|
||||
while True:
|
||||
try:
|
||||
return googletrans.Translator().translate(text, src=src_lang, dest=dest_lang)
|
||||
# https://github.com/ssut/py-googletrans/issues/234#issuecomment-736314530
|
||||
return googletrans.Translator(service_urls=['translate.googleapis.com']).translate(text, src=src_lang, dest=dest_lang)
|
||||
except AttributeError:
|
||||
time.sleep(0.5)
|
||||
result = await client.loop.run_in_executor(None, _translate)
|
||||
|
|
Loading…
Reference in New Issue