pat310 / google-trends-api

An API layer on top of google trends
https://www.npmjs.com/package/google-trends-api
MIT License
874 stars 174 forks source link

realtimeTrends sends "Error 400 (Bad Request)!!1" when queried with certain country code #159

Open thoriqadillah opened 2 years ago

thoriqadillah commented 2 years ago

I have a problem that give me "Error 400 (Bad Request)!!1" when I use my country code in geo option, Indonesia (ID). Other message from the error is

</span></a><p><b>400.</b> <ins>That’s an
        error.</ins><p>The server cannot process the request because it is
        malformed. It should not be retried. <ins>That’s all we know.</ins></div>

my code :

googleTrends.realTimeTrends({
        geo: 'ID',
        category: 'all',
    }, function(err, results) {
        if (err) {
            res.send(err);
        } else {
            res.send(results);
        } 
    });

anyone has the same issue?

blackIImesa commented 2 years ago

Not all country codes have daily trends available to them. For example check the web page: https://trends.google.com/trends/trendingsearches/daily?geo=id.

I was having same issue with my app where you click a country on the map and it shows daily trends, clicking a lot of countries in Africa returned the same error. I tested Indonesia and had the same error.