Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why i am getting 503? #67

Open
iamanam opened this issue May 17, 2018 · 8 comments
Open

why i am getting 503? #67

iamanam opened this issue May 17, 2018 · 8 comments

Comments

@iamanam
Copy link

iamanam commented May 17, 2018

It works only for first few requests. After many requests it rejects and shows 503 Error. Did they implement any rate limiting?

Please check it out.

{ HTTPError: Response code 503 (Service Unavailable)
at stream.catch.then.data (/index.js:123:13)
at
at process._tickCallback (internal/process/next_tick.js:160:7)
..................

@hdatteln
Copy link

I am seeing similar issues today; used to work fine, but now after a few requests, i am getting a 'Bad Request' error, and when debugging more, i see that it's rate limiting

@iamanam
Copy link
Author

iamanam commented May 17, 2018

@hdatteln please let me know if you have found anything alternative? Do you have any idea so far?

@hdatteln
Copy link

hdatteln commented May 18, 2018

I added a few logging statements and then saw a 'Our systems have detected unusual traffic from your computer network;' & a reCaptcha check as a response message to the google api call that this google-translate-api module makes.
For my purposes (language detection) I stopped using the google-translate-api module, and switched to using 'detectlanguage' module.

@Sandeeprao69
Copy link

Hey did you find any solution for this?

@iamanam
Copy link
Author

iamanam commented May 22, 2018

i am using a python version, it works fine on the same server. The generated token is same, url params and generated Url is also almost same.

def build_params(query, src, dest, token):
    params = {
        'client': 't',
        'sl': src,
        'tl': dest,
        'hl': dest,
        'dt': ['at', 'bd', 'ex', 'ld', 'md', 'qca', 'rw', 'rm', 'ss', 't'],
        'ie': 'UTF-8',
        'oe': 'UTF-8',
        'otf': 1,
        'ssel': 0,
        'tsel': 0,
        'tk': token,
        'q': query,
    }
    print(params)
    return params

and this node version

      var url = "https://translate.google.com/translate_a/single";
      var data = {
        client: "t",
        sl: opts.from,
        tl: opts.to,
        hl: opts.to,
        dt: ["at", "bd", "ex", "ld", "md", "qca", "rw", "rm", "ss", "t"],
        ie: "UTF-8",
        oe: "UTF-8",
        otf: 1,
        ssel: 0,
        tsel: 0,
        kc: 7,
        q: text
      };
      data[token.name] = token.value;
      console.log(data);
      return url + "?" + querystring.stringify(data);

How can python one works when the nodejs can't? Any idea?

@0xdeade1f
Copy link

@iamanam can you show the result of the complete request, headers and all?

@iamanam
Copy link
Author

iamanam commented May 23, 2018

@0xdeade1f here is the headers and url from python version

response header:

{'Connection': 'keep-alive', 'Cookie': 'NID=130=B2U7oyM_HaGncf7MM1FVZ6yFIiiByM12hCnSm5KkdCm1JKHGbOt-dI6w9yBAl7MXQWw_dRwtlHBv4mgkp5531p_TcPhEwQ91dzk0O4CKL4PEDD-pPLmK9qm_Y3TPlKni', 'Accept-Encoding': 'gzip, deflate', 'Accept': '/', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'}

Request header:

{'X-XSS-Protection': '1; mode=block', 'Content-Disposition': 'attachment; filename="f.txt"', 'X-Content-Type-Options': 'nosniff', 'Transfer-Encoding': 'chunked', 'Accept-Ranges': 'none', 'Expires': 'Fri, 01 Jan 1990 00:00:00 GMT', 'Vary': 'Accept-Encoding', 'Server': 'HTTP server (unknown)', 'Pragma': 'no-cache', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Date': 'Wed, 23 May 2018 22:36:31 GMT', 'X-Frame-Options': 'SAMEORIGIN', 'Alt-Svc': 'hq=":443"; ma=2592000; quic=51303433; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=":443"; ma=2592000; v="43,42,41,39,35"', 'Content-Type': 'application/json; charset=UTF-8'}

Url:

https://translate.google.com/translate_a/single?otf=1&tsel=0&hl=bn&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&q=good&tl=bn&client=t&tk=865544.740366&sl=auto&ssel=0

@aattoade
Copy link

This is a warning that Google is cracking down on this repo and many others that are similar.

In case you have not noticed, it uses a token hack to generate a unique token every hour, this is likely to be illegal and could get you in trouble.

Do not use this for production projects - you can see for yourself here:
https://github.com/matheuss/google-translate-token

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants