Google Trends에 로그인하여 csv 데이터를 다운로드하려면 matlab을 사용할 수 있습니다. 먼저 DownloadString을 사용한 다음 fastawrite를 사용하여 csv 파일을 저장하기 전에 matlab 문자열로 변환했습니다.WebClient.DownloadFile을 호출 할 때 Matlab 로그인 및 다운로드 오류가 발생했습니다.
비록 문자열이 올바르게 다운로드되었다고해도 '\ n'줄은 형식을 잃어 버렸습니다 ... '\ n'파일을 셀 배열로 분할하면 서식이 잘되므로 ! 그래서
는 지금 작동하려면 DownloadFile 방법을 얻으려고하지만 나는 다음과 같은 오류가 계속 :'System.Net.WebClient'
클래스 발견 일치하는 서명이 없음 방법 없다 'DownloadFile'NET.addAssembly('System.Net');
url = 'https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&Email=email&Passwd=pass&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'); sid = sid(1,1);
client.Headers.Add('Cookie', char(sid));
assignin('base','googleWebClient',client);
end
saveFilePath = System.String(strcat('C:\Dropbox\PROJECTS\', keyWord, '.csv'));
data = client.DownloadFile(durl, saveFilePath);
정말 고마워요 !! 나는 벽에 머리를 대고있다. 나는 데이터를 삭제했다. 그리고 그것은 csv 파일을 그대로 다운로드하고있다. 그것은 내가 char (data) 함수를 사용하여 System.String에서 matlab char로 변환 한 다음 fastawrite를 사용하여 저장하면 포맷팅이 손상되었다고 생각됩니다. – user1229124
죄송합니다. regexprep (sid) 형식이 좋으며 DownloadFile과 반대로 DownloadString을 사용하고 있었으며 어떤 이유로 포맷 오류가 CSV 파일에 들어 왔습니다 ... – user1229124