Comments (8)
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.
@hdatteln please let me know if you have found anything alternative? Do you have any idea so far?
from google-translate-api.
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.
Hey did you find any solution for this?
from google-translate-api.
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.
@iamanam can you show the result of the complete request, headers and all?
from google-translate-api.
@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:
from google-translate-api.
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)
- Can we call this translate() in loop?
- Can't translate, getting error. HOT 3
- [error] Module not found: Can't resolve 'child_process'
- can not translate while using it in gulpfile? HOT 2
- code: 'BAD_REQUEST HOT 9
- Uncaught TypeError: exec is not a function HOT 2
- 近期google-translate-api更新一次 HOT 3
- Incorrect token generation (403 forbidden error) HOT 1
- Docker please!
- BAD_REQUEST HOT 3
- BAD_NETWORK HOT 1
- Here's how to fix the BAD_REQUEST error on the npm package HOT 1
- Suggest package to replace while this return BAD_REQUEST HOT 1
- Is this package deprecated? HOT 3
- I don't find my language HOT 1
- Error: Unable to resolve module HOT 1
- Error in google-translate-api: BAD_REQUEST code in index.js HOT 7
- bad request HOT 2
- connecting this API to Smartcat or Matecat
- BAD REQUEST! HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-translate-api.