2
私はつぶやきをダウンロードしたい(特定の質問を検索せずに)。 「:パスワードuserpwd = "ユーザ名」私は、次の情報含むテキストファイルである結果、取得:Twitter、エラー:401 '/1/statuses/sample.json'にアクセスしています。理由:無許可
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>
<title>Error 401 Unauthorized</title>
</head>
<body>
<h2>HTTP ERROR: 401</h2>
<p>Problem accessing '/1/statuses/sample.json'. Reason:
<pre> Unauthorized</pre>
私が探していますが、私は抑制する場合のみ
curlPerform(url = https://stream.twitter.com/1/statuses/sample.json -u USER:PASSWORD -o "somefile.txt"
# set the directory
setwd("C:\\")
#### redirects output to a file
WRITE_TO_FILE <- function(x) {
if (nchar(x) >0) {
write.table(x, file="Twitter Stream Capture.txt", append=T, row.names=F, col.names=F)
}
}
### windows users will need to get this certificate to authenticate
download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem")
### write the raw JSON data from the Twitter Firehouse to a text file
getURL("https://stream.twitter.com/1/statuses/sample.json",
cainfo = "cacert.pem",
write=WRITE_TO_FILE)
:私はあなたのアドバイスを試してみましたR内に完全に滞在し、Windowsを使用する必要があります。この問題を解決する方法上の任意のアドバイスを?事前に
感謝を
ありがとうございました。ユーザー名とパスワードをTwitterのユーザー名とパスワードに変更しましたが、残念ながら問題は解決しませんでした。私は得た:function(x){if(nchar(x)> 0){write.table(x、file = "twitter_stream_capture.txt"、append = TRUE、row.names = FALSE、col.names = FALSE)read。 \ n
\ n \私が上に投稿したコードはRCurl_1.6-10.1で私にとって完璧に動作します。 – jbaums
ありがとうございます。私は自分がRCurl_1.91-1.1 bitops_1.0-4.1であることに気付きました。それは問題であるべきですか?それとも、私がfile = 'twitter_stream_capture.txt'のデータにアクセスしようとしているのでしょうか? (私は 'readHTMLTable'を使用しました)? –