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

relatedQueries category key does nothing #163

Open cbaucom opened 2 years ago

cbaucom commented 2 years ago

According to the README, the relatedQueries api takes an optional category param. However, upon testing this out with different category numbers, the data never changes.

Sample code:

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

googleTrends.relatedQueries({
   keyword: 'javascript', 
   startTime: new Date('2021-01-01'),
   endTime: new Date('2022-01-01'),
   geo:'US',
   category: 0 
})
.then((res) => {
  console.log(res);
})
.catch((err) => {
  console.log(err);
})

When changing the number 0 above, which references "All Categories", to another acceptable category ID like 16 (News) or 67 (Travel), the data never changes. Full category wiki here.

Am I missing something here on how to properly query by category as well?