I use pytrends
to automatically download data in csv
from google trend. The code i used is below. In this case, i am downloading a monthly google trend data from 2008 to present.
from pytrends.request import TrendReq
from urllib.parse import unquote
from dateutil.relativedelta import relativedelta
import datetime
import pytrends
google_username = "xxxxx@gmail.com"
google_password = "xxxxx"
search_term = unquote('%2Fm%2F07gyp7')
google_trend = TrendReq(google_username, google_password, custom_useragent='Pytrends' )
google_trend_payload = {'gprop' : 'news' , 'q': search_term}
trendresult = TrendReq.trend(google_trend_payload, return_type = 'dataframe')
print(trendresult)
The result from google website for the first 5 months compared with the result from pytrends:
Date Pytrends data Manual csv data
2008-01 21.0 28.0
2008-02 16.0 19.0
2008-03 16.0 21.0
2008-04 15.0 18.0
2008-05 22.0 31.0
Anyone know the reason? Thank you.