2

正如我在标题中所说,即使从第一个请求开始,我也总是(据说)达到速率限制。因此,我无法从 twitter 下载任何内容。

这是我在 R 中的示例代码:

tweets = searchTwitter('blabla', n=1, cainfo = "cacert.pem")

我不断收到这条消息:

[1] "Too Many Requests"
[1] "Rate limited .... blocking for a minute ..."

我可以尝试什么?


reqURL <- "http://api.twitter.com/oauth/request_token"
accessURL <- "http://api.twitter.com/oauth/access_token"
authURL <- "http://api.twitter.com/oauth/authorize"
consumerKey <- "KEY"
consumerSecret <- "KEY"
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
                         consumerSecret=consumerSecret,
                         requestURL=reqURL,
                         accessURL=accessURL,
                         authURL=authURL)
twitCred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))
registerTwitterOAuth(twitCred)
tweets = searchTwitter('blabla', n=10, cainfo = "cacert.pem")

代码如上。没有任何明显的原因,我设法下载了一些推文,但有时我仍然不断收到这条消息。

此外,我正在搜索一个字符串,但我无法找到它,尽管我 100% 确定它存在于 twitter 上。我收到一条消息,表明没有从服务器检索到响应。

4

1 回答 1

1

I got the same problem, too. But I think the reason is that the new Twitter API sets its "rate limits" to only allow 15 calls in 15 minutes.

Therefore, if you exceed the rate limitation, your account will be blocked for a while... But you'll be able to access the data after another 15 mins. (It works for me! You may try.)

For your reference: http://www.tweetings.net/site/2012/10/rate-limits-and-the-new-twitter-api/

于 2013-04-03T06:07:45.953 回答