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

relatedTopics getting empty results - not sure if still working #166

Open royherma opened 1 year ago

royherma commented 1 year ago

Hey, so trying to run a simple example of getting "related topics" to a specific keyword in the last 24 hours.

My code looks like so:

//get relatedTopics for the last 24 hours
const relatedTopics = await googleTrends.relatedTopics({
   keyword: searchTerm,
   startTime: new Date(Date.now() - 24 * 60 * 60 * 1000),
   endTime: new Date(),
});

console.log(`search_term ${searchTerm} raw result`, relatedTopics);

However, my results keep on coming blank like so:

Screen Shot 2022-10-15 at 19 10 03

It does look like it running the API call though as the raw JSON contains the "default" and "rankedList" params

Any idea as to what i'm doing wrong?

Thanks!

royherma commented 1 year ago

Update - it works when i don't supply startTime and endTime.. any ideas? In meantime playing around w/ more