google-translate-api: Response code 403 (Forbidden)
I recently began receiving 403 errors when using google-translate-api
. Digging in to the source a bit, this is the error that is being thrown:
{
"message": "Response code 403 (Forbidden)",
"host": "translate.google.com",
"hostname": "translate.google.com",
"method": "GET",
"path": "/translate_a/single?client=t&sl=en&tl=fr&hl=fr&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=1&ssel=0&tsel=0&kc=7&q=A-Z%20Site%20Index&tk=801225.801225",
"statusCode": 403,
"statusMessage": "Forbidden"
}
Based on this comment, it seems that Google may have added in some rate limiting that may affect this module. Can you verify if this is the root cause?
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 26
Links to this issue
Commits related to this issue
- Avoids error in google-translate-api npm package Sources package from vitalets/google-translate-api as described in issue https://github.com/matheuss/google-translate-api/issues/79 — committed to AlooAkbar/C-3PO by AlooAkbar 6 years ago
- Updating based on errors we were getting from Google translate: https://github.com/matheuss/google-translate-api/issues/79\#issuecomment-443428475 — committed to eosdac/Translation-Bot by lukestokes 5 years ago
- Fix BAD_REQUEST error on VPS SEE https://github.com/matheuss/google-translate-api/issues/79#issuecomment-427841889 — committed to arnaudjuracek/bot-titre-de-pornos by arnaudjuracek 5 years ago
- Update google-translate-core.el Use 'gtx' instead of 't' as ``client`` parameter. (see https://github.com/matheuss/google-translate-api/issues/79 ) — committed to kdmsnr/google-translate by kdmsnr 5 years ago
I forked google-translate-api and google-translate-token and made it work.
You can try by installing:
UPDATE: Published to npm as @vitalets/google-translate-api:
See also https://github.com/matheuss/google-translate-api/issues/79#issuecomment-443428475
I changed the line 35 to
client: 'gtx',
instead ofclient: 't',
and it’s working for me now.I’ve published to npm working scoped package @vitalets/google-translate-api:
After install don’t forget to use scope in
require
:Also I’ve added
client
parameter to be able to setclient: 'gtx'
instead ofclient: 't'
:gtx no longer functions correctly.
After looking at it it seems to be a way for Google Translate Plugin to receive translations without creating a token. Thus it was never meant to be used for many translations. Vitalets as well as matheuss’s forks are creating incorrect tokens which is seriously affecting functionality.
Could a team be brought together to fix such errors who know how to work with this? I would be of limited help but I do want to help, this would be a huge help.
@vitalets your solution is no longer working for me. I forked google-translate-api as well and edited index.js line 35 as suggested, from
client: 't',
toclient: 'gtx',
. That did the trick. Hopefully the npm package will be fixed soon, but until then if you want you can just add"google-translate-api": "AlooAkbar/google-translate-api",
to your package.jsonI can make a scoped package, but frankly speaking I’m not a fan of many similar packages in npm.
Hi @matheuss, could you kindly have a look on https://github.com/matheuss/google-translate-token/issues/12 and merge it? As it blocks the functionality of both packages. Thanks in advance!