來獲取數據,我想用RCurl登錄到網站,並從網站獲取數據(該數據不能無需登錄可見。)登錄到網站使用RCurl
我想導出這個(例如)在使用RCurl登錄後,將「http://www.appannie.com/app/ios/instagram/ranking/history/chart_data/?s=2010-10-06&e=2012-06-04&c=143441&f=ranks&d=iphone」轉換爲R。問題是我無法使用RCurl登錄。我之前沒有嘗試過這麼多,所以我提到了http://www.omegahat.org/RCurl/philosophy.html。
所以這是我的嘗試。 (在這裏, '[email protected]' 是我的用戶ID和 '9999' 是我的密碼 - 我只是做它。)
library(RJSONIO)
library(rjson)
library(RCurl)
appannie <- getURL("http://www.appannie.com/app/ios/instagram/ranking/history/chart_data/.json?s=2010-10-06&e=2012-06-04&c=143441&f=ranks&d=iphone, userpwd = [email protected]:9999", verbose = TRUE)
但是,這給我的留言如下:
About to connect() to www.appannie.com port 80 (#0)
* Trying 69.167.138.64... * connected
* Connected to www.appannie.com (69.167.138.64) port 80 (#0)
> GET /app/ios/instagram/ranking/history/chart_data/?s=2010-10-06&e=2012-06-04&c=143441&f=ranks&d=iphone HTTP/1.1
Host: www.appannie.com
Accept: */*
< HTTP/1.1 403 FORBIDDEN
< Server: nginx/1.1.19
< Date: Fri, 01 Mar 2013 23:41:32 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Keep-Alive: timeout=10
< Vary: Accept-Encoding
< Vary: Cookie,Accept-Encoding
<
* Connection #0 to host www.appannie.com left intact
所以,我又回頭看了這個http://www.omegahat.org/RCurl/philosophy.html,不知道該怎麼做,所以在我看到來自stackoverflow的類似問題後,我嘗試了這個。
getURL("http://www.appannie.com/app/ios/instagram/ranking/history/chart_data/?s=2010-10-06&e=2012-06-04&c=143441&f=ranks&d=iphone",.opts=list([email protected]:9999"))
但是,這給了我下面的輸出。
[1] ""
任何人都可以給我一個提示嗎? (一堆不同的試驗後,網站開始向我發送警告=(
這是否幫助'appannie < - 使用getURL(「http://www.appannie.com/app/ ios/instagram/ranking/history/chart_data/.json?s = 2010-10-06&e = 2012-06-04&c = 143441&f = ranks&d = iphone「,userpwd =」[email protected]:9999「,verbose = TRUE) 「?看着' ?getURL' – 2013-03-02 00:50:53
您是否閱讀了他們的[博客文章](http://blog.appannie.com/hourly-rankings-parent-publishers-data-export-analytics-api/)關於api允許您訪問數據以編程方式作爲私人測試版?也許你會通過在[email protected]註冊獲得更多的運氣。顯然,您也可以爲您自己的應用下載.csv數據。 – 2013-03-02 14:04:49
@Eric,謝謝你的回覆。順便說一句,我使用的第一個代碼和你放的代碼之間有什麼區別? (不知何故,它看起來和我一樣..) – user1486507 2013-03-04 18:37:05