Giter Club home page Giter Club logo

Comments (8)

hdatteln avatar hdatteln commented on May 23, 2024

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

from google-translate-api.

iamanam avatar iamanam commented on May 23, 2024

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

from google-translate-api.

hdatteln avatar hdatteln commented on May 23, 2024

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.

from google-translate-api.

Sandeeprao69 avatar Sandeeprao69 commented on May 23, 2024

Hey did you find any solution for this?

from google-translate-api.

iamanam avatar iamanam commented on May 23, 2024

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?

from google-translate-api.

0xdeade1f avatar 0xdeade1f commented on May 23, 2024

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

from google-translate-api.

iamanam avatar iamanam commented on May 23, 2024

@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

from google-translate-api.

aattoade avatar aattoade commented on May 23, 2024

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

from google-translate-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.