mepeichun / SubtitleTranslate

Translate the subtitle file into other language
GNU General Public License v3.0
106 stars 37 forks source link

HTTP Error 400: Bad Request #4

Open yeahman45 opened 2 years ago

yeahman45 commented 2 years ago

I have tried the sample.py and I am getting this error (I am using python 3.7):

/SubtitleTranslate-master/util_trans.py", line 73, in __post
    response = urllib.request.urlopen(request)
  File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.7/urllib/request.py", line 563, in error
    result = self._call_chain(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 755, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request
Doublefire-Chen commented 2 years ago

Me too!

zhijia2 commented 2 years ago

me too

sadgen commented 1 year ago

api url已经失效。如果可以访问Google,把util_trans.py里的__translate函数中goolge.cn改成google.com即可。

EmilioSchi commented 1 year ago

Change the base url at 78 line.

I resolve write this: url = "http://translate.googleapis.com/translate_a/single?client=t" \