Downloading Search Query Data
After many years of demand by the SEO and webmaster community, Google has finally given us an API option to download search query data from Google Webmaster Tools.
For years now, the drill has been the same. Log into Google Webmaster Tools, navigate to search queries, set the parameters, date range and filters and export data. We were grateful to have an export function in the first place but the way to download data was very restricted and it still is for many things including link data. Now we have an option and it seems they are busy with enabling more. Jonathan Simon, Webmaster Trends Analyst reports on this in detail in Google Webmaster Central .
The Python script comes from Webmaster Tools Download Project: http://code.google.com/p/webmaster-tools-downloads/
To make use of this facility go to Google Data APIs Python Client Library download and install the library. Add the script downloader.py to a new folder and copy the following script example-create-spreadsheet.py to it as well. (Customise it to replace the dummy values). Run the example-create-spreadsheet.py script in your Terminal:
You can see your data in Google Docs:
Use example-simple-download.py to download the spreadsheet (CSV) without storing it in Google Docs. What’s great about this script is that it can be configured to regularly download and store fresh data ready for manipulation, reports and visualisation.
Watch out for security as this script contains Google account username and password stored. The script uses https as default as the first layer of protection of your data.
 Simon, J. – Google Webmaster Central Blog: http://googlewebmastercentral.blogspot.com/2011/12/download-search-queries-data-using.html