Open hfldrd opened 6 years ago
@pat310
Check out the examples here, particularly the one at this line: https://github.com/pat310/google-trends-api/blob/master/examples.js#L29
I saw/thought the same thing. It looks like "granularTimeResolution" needs to be set for this to work in this case.
It is worth noting that I never see the API data match the web interface for data less than "daily" frequency -
const googleTrends = require('google-trends-api');
googleTrends.interestOverTime({
keyword: 'Valentines Day',
startTime: new Date(Date.now() - (4 * 60 * 60 * 1000)),
granularTimeResolution: true,
}, function(err, results) {
if (err) console.log('oh no error!', err);
else console.log(results);
});
WEB and CSV return this, when API is debugged it is not close to this:
and the API appears to count time UP (into the future) when this is used (2:06 CST was the latest this data above is from. So 3:06 EST in that and should not be higher or going up):
The API is not getting any data from the last 72 hours. try any code, and it shows up blank
this is an example of non working code, if you change the date to june 11th it works
const express = require("express"); const trends = require('google-trends-api'); const app = express(); const moment = require('moment'); const PORT = process.env.PORT || 9090; const data = {}; const path = require('path');
googleTrends.interestOverTime({keyword: 'Valentines Day', startTime: new Date(Date.now() - (4 60 60 * 1000))}, function(err, results) { if (err) console.log('oh no error!', err); else console.log(results); });