Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: cookies/authorisation to access google trends csv
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Adam Chapman

Posts: 171
Registered: 1/12/09
cookies/authorisation to access google trends csv
Posted: Jun 6, 2013 12:00 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I'm trying to download a csv of google trend data, as was done at http://stackoverflow.com/questions/9419444/matlab-login-and-download-failure-when-calling-webclient-downloadfile in February 2012.

My existing code looks like this:


keyWord='mickey mouse'


url = ['https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&Email=' USERNAME '&Passwd=' PASSWORD '&service=trendspro&source=test-test-v1';
durl = System.String(strcat('http://www.google.com/trends/viz?q=', keyWord, '&date=all&geo=all&graph=all_csv&sort=0&scale=1&sa=N'));

if exist('googleWebClient','var')
client = googleWebClient;
client = System.Net.WebClient;

response = client.DownloadString(url);
sid = char(response.ToString);
sid = regexp(sid, '\n', 'split'); %sid = sid(1,1);

client.Headers.Add('Cookie', char(sid(1)));


saveFilePath = System.String(strcat('C:\Dropbox\PROJECTS\', keyWord, '.csv'))



If anybody runs this they will see that the returned csv file contains nothing useful.

I have found something that may be a bit sompler to access:

although I think this wants some authentication data for access.

I did notice in the original code above that the variable "response" contains 3 pieces of information (SID, LSID & AUTH)

Is anybody able to access either a csv or json formatted data from matlab alone?
Both urls are accessible through any web browser I've used, but matlab is struggling.

Any help is massively appreciated

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.