google-trends-api icon indicating copy to clipboard operation
google-trends-api copied to clipboard

Error 400

Open cjm771 opened this issue 7 years ago • 5 comments

Is this still working? I recieved an Error 400 when querying the api! JW thanks!

cjm771 avatar May 15 '18 00:05 cjm771

@cjm771 are you still having trouble? I'm getting results back when testing.

Did you make a lot requests in a short time frame or was it just once? Also, can you share the query (which api method) you are trying?

pat310 avatar May 20 '18 17:05 pat310

Sure! I am trying just once. Looks like the end point is: https://trends.google.com/trends/fetchComponent?q=Seahawks&cid=TIMESERIES_GRAPH_0&export=3

Code Below

const googleTrends  = require('google-trends-api');

//interest by region
googleTrends.trendData("Seahawks").then( (res) => console.log("interest By region",res))
	.catch( (err) => console.log("an error occurred",err));

Results in

 <!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>Resource unavilable</title></head><body>This resource is no longer available.<br>If you require support please email [email protected] <br>Please include details about how you are using the Trends data.</body></html>

cjm771 avatar May 21 '18 18:05 cjm771

@cjm771 what version of are you using? trendData isn't a method anymore, can you try upgrading to 4.6.2?

pat310 avatar May 30 '18 02:05 pat310

I also have 400 error with googleTrends.interestOverTime API. I used to have 429 error, this error is resolved after update to v4.2.6, now I have 400 error.

Hannah-Jiang avatar May 31 '18 20:05 Hannah-Jiang

@pat310 I was using v3.0.2, in an effort to resolve similar issues with the latest version at that time. Running latest v4.6.2, Everything looks to be working using following code :) Man I wish the api gave daily resolution for some of the endpoint, rather than monthly am I right? heh.

const googleTrends = require('google-trends-api');

//interest by region
googleTrends.interestOverTime({keyword: 'Seahawks'}, function(err, results){
  if(err) console.error('there was an error!', err);
  else console.log('my sweet sweet results', results);
})

cjm771 avatar Jun 02 '18 17:06 cjm771