I hit the rate limit for twitteR even from the first request

家住魔仙堡 提交于 2019-12-13 02:43:32

问题


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/



来源:https://stackoverflow.com/questions/15578971/i-hit-the-rate-limit-for-twitter-even-from-the-first-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!