2012-01-29 5 views
7

で「有益なUser-Agent文字列」私はページのリストを取得し、次のエラーを取得するWikipediaのページにアクセスしようとしています:設定のgetURL

library(RCurl) 
u <- "http://en.wikipedia.org/w/index.php?title=Special%3APrefixIndex&prefix=tal&namespace=4" 
getURL(u) 
[1] "Scripts should use an informative User-Agent string with contact information, or they may be IP-blocked without notice.\n" 

私はそのページに到達するために願っていますWikipediaのapiを通じて、しかしI am not sure it would work

この事は、たとえば、他のページが問題なく読み込まれていることである。

u <- "http://en.wikipedia.org/wiki/Wikipedia:Talk" 
getURL(u) 

任意の提案ですか? the documentation of RCurlによると、一般的には、私はむしろ、wikiページをこすりしないようになり、APIを介して行くが、私は、この特定のページにはAPIを介してまだ利用できないことを恐れて...

答えて

13

、次のことができます。

サイドノートhttpheaderパラメータを追加して追加のヘッダーを指定してください:

getURL(u, httpheader = c('User-Agent' = "Informative string with your contact info")) 
+0

パーフェクト - ありがとうございます。 –

関連する問題