lushan88a / google_trans_new

A free and unlimited python API for google translate.
MIT License
393 stars 170 forks source link

404 Error #62

Open eddieberklee opened 1 year ago

eddieberklee commented 1 year ago

Here's the error I'm getting:

`Traceback (most recent call last): File "/opt/homebrew/lib/python3.9/site-packages/google_trans_new/google_trans_new.py", line 189, in translate r.raise_for_status() File "/opt/homebrew/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_errormsg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://translate.google.cn//TranslateWebserverUi/data/batchexecute

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/elee/android-projects/etils-translator/main.py", line 216, in translateToFile(file) File "/Users/elee/android-projects/etils-translator/main.py", line 166, in translateToFile translated = translate(english_string, existing_country_folder.country_code) File "/Users/elee/android-projects/etils-translator/main.py", line 141, in translate return google_trans_new.google_translator() \ File "/opt/homebrew/lib/python3.9/site-packages/google_trans_new/google_trans_new.py", line 194, in translate raise google_new_transError(tts=self, response=r) google_trans_new.google_trans_new.google_new_transError: 404 (Not Found) from TTS API. Probable cause: Unknown`

Veivel commented 1 year ago

I've been getting the exact same issue. I figured the URL may be causing an issue, so I tried to change the url_suffix parameter of the google_translator object. Didn't work. My internet is working fine.

ifhjl commented 1 year ago

Me too still have problem using it

Ericocococo commented 1 year ago

google_translator(url_suffix="com") replace default (url_suffix="cn") ,have a try.

chrk623 commented 5 months ago

As of March 27 2024, i needed to change the following lines in google_translator.translate:

# remove
response = (decoded_line + ']')

# change
response = json.loads(response)
# to
response = json.loads(decoded_line)

As for detect, this works: https://github.com/lushan88a/google_trans_new/issues/60#issuecomment-1681549522

Are PRs still accepted?