pedrofaustino / google-trends-csv-downloader Goto Github PK
View Code? Open in Web Editor NEWPython script that uses HTTP to download Google Trends data in CSV format. It provides authentication to Google services.
Python script that uses HTTP to download Google Trends data in CSV format. It provides authentication to Google services.
I'm having trouble though with trying to download specific dates. Google Trends itself allows for this (for example: http://www.google.com/trends/explore#q=hi&date=1%2F2007%203m&cmpt=q). I'm having trouble passing this into get_csv however. Does anyone know how to handle this?
I made some changes to the code to try to hack this out.
params.update(kwargs)
params = urllib.urlencode(params)
params = params.replace('+', '%20')
#So what's going on is that urlencode wants to encode the space in the
#trendsReport date variable as a +, when we want it encoded as a space,
#which in HTMl encoding is %20.
complete_url = self.url_download + params
print complete_url
r = urllib2.urlopen(complete_url)
My usage is:
r.get_csv(q='job', geo='US-'+state, date='1/2012 7m')
When I put the url generated into the browser, it works. But I get the quota error when I try running it on python.
Thanks
While investigating/cross-checking about querying on the date search query I came across this problem.
test:
from pyGoogleTrendsCsvDownloader import pyGoogleTrendsCsvDownloader r = pyGoogleTrendsCsvDownloader(login, password') r.get_csv(cat='0-958',date='1/2006 12m', geo='US-ME-500')
error:
Traceback (most recent call last): File "test.py", line 6, in <module> r.get_csv(cat='0-958',date='1/2006 12m', geo='US-ME-500') File "/home/savril/workspace/google-trends-csv-downloader/pyGoogleTrendsCsvDownloader.py", line 134, in get_csv myFile = open('trends_%s.csv' % '_'.join(['%s-%s' % (key, value) for (key, value) in kwargs.items()]), 'w') IOError: [Errno 2] No such file or directory: 'trends_date-1/2006 12m_geo-US-ME-500_cat-0-958.csv'
Hello the code is not working for me as of today. :(
i always get "You've exceeded your quota. Continue tomorrow..." although i can still download csv via the browser and the same account.
Maybe you could try to make it working again.
THX
yours John
Hi,
I tried to port this to 3.5 and can't get it to work after porting. I keep getting the error "You have exceeded today's quota". If you have a workaround or suggestion, please let me know. I can share the code too if you want.
Thanks,
When attempting to download Google Trends data, the authentication portion gets through fine (after #1), but get_csv() terminates, complaining that the quota has been exceeded.
However, manually logging in with a browser and clicking on the download CSV link appears to work. It looks like we aren't sending enough cookies back for some reason. Using Curl, I managed to narrow down the necessary cookies to:
However, it looks like we're not getting the PREF cookie at all during the login process. Very weird..
I modified the account and change a computer, or suggested that I "You've exceeded your quota. Continue tomorrow ..."
Did Google also based on other information?
The code works fine, I would like to know how to search for different keywords? Any ideas?
Script no longer works (since Google Trends UI was overhauled).
urllib2.HTTPError: HTTP Error 307: Temporary Redirect
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.