I hit the rate limit for twitteR even from the fir

2019-07-25 21:38发布

问题:

As I say in the title, I always hit the rate limit (supposedly) even from the first request. Therefore, I cannot download anything from twitter.

Here is my example code in R:

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

And I keep getting this message:

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

What could I try?


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")

The code is the above. Without any apparent reason, I managed to download some tweets but sometimes I still keep getting this message.

Moreover, I'm searchong for a string and I cannot find it although I'm 100% sure that it exists on twitter. I'm getting a message that no response was retrieved from the server.

回答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/