2013-06-06 9 views
5

Pracowałem z oryginalnego kodu opublikowanego pod numerem Matlab login and download failure when calling WebClient.DownloadFile, aby wypróbować i pobrać dane trendów Google w csv bezpośrednio z MATLAB.matlab pobierz google trends csv

czytałem też w poście Emanuele pod adresem login with curl and get session że polityka uwierzytelniania Google zmieniła się, a teraz mój kod wygląda następująco:

NET.addAssembly('System.Net'); 

url = strcat(['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; 
else 
    client = System.Net.WebClient; 

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

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

    client.Headers.Add('Authorization', strcat( 'GoogleLogin ' , char(sid(3)) ) ); 


end 


client.DownloadString(durl) 

które unforgivingly powraca:

ans = 

<div id="report"> 
    <div class="timeBandTitle">An error has been detected</div> 
    <div class="timeBandSubTitle">You have reached your quota limit. Please try again later.</div> 
    </div> 

Jeśli ktoś jest w stanie dostęp do danych trendów Google csv z MATLAB, jesteś moim bohaterem

Odpowiedz

0

Zakładając, że nie osiągnąłeś limitu limitu, podejrzewam, że nie masz turned on API access. (Interpretowane jako limit przydziału 0 ?!)

Można go znaleźć w ramach usług.