'Google Trends API - data frequency
I have gained access to the Google Trends API and tried downloading some trends data using the getting started guide's code:
start_date = '2010-01'
end_date = '2018-01'
response = service.getGraph(terms='apple',restrictions_startDate=start_date,restrictions_endDate=end_date).execute()
pprint.pprint(response)
This returns monthly data. Is there a way to get the data in daily frequency?
Solution 1:[1]
Google Trends API Data frequency currently includes the Weekly and Monthly frequencies, country wise trend subscription
Currently Weekly is the shortest time accepted by the Google Trends API but in future might be available for daily time scale frequency.
Solution 2:[2]
Try using a shorter time period to get weekly or daily resolutions.
Solution 3:[3]
getGraph returns results by week only. To get results by day, use getTimelinesForHealth instead and add the parameter timelineResolution = 'day', as in:
response = service.getTimelinesForHealth(
terms = ?'apple'?,
time_startDate = 'YYYY-MM-DD',
time_endDate = 'YYYY-MM-DD',
timelineResolution = 'day'
).execute()
Note that restrictions_startDate and restrictions_endDate should be
changed to time_startDate and time_endDate respectively, and the time
is indicated in the format 'YYYY-MM-DD'.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ramana V V K |
| Solution 2 | Shalev Manor |
| Solution 3 |
