Google Trends Parser - Custom Time Range

scrapefun

A-Parser Enterprise License
A-Parser Enterprise
Is there a way to make a macro that will set a date range for the past 8 days that I can use in the "custom time range" field in the Google Trends parser?

Currently, I have to update manually every day which is a pain so would be great to automate if possible.
 
This can be done with a small script and tools.js.
Code:
Tools.prototype.getDateRange = function(days) {
    let d = new Date();
    const end = d.getFullYear() + '-' + ('0' + (d.getMonth() + 1)).substr(-2) + '-' + ('0' + d.getDate()).substr(-2);
    d.setDate(d.getDate() - days);
    const start = d.getFullYear() + '-' + ('0' + (d.getMonth() + 1)).substr(-2) + '-' + ('0' + d.getDate()).substr(-2);
    return `${start} ${end}`;
}
fqjbo_230427110626.png
 
Back
Top