我正在使用this示例从Twitter提取推文。
由于达到速率限制,我收到以下错误。如何设置费率?

429:Returned in API v1.1 when a request cannot be served due to the application's rate limit having been exhausted for the resource. See Rate Limiting in API v1.1.(https://dev.twitter.com/docs/rate-limiting/1.1)
message - Rate limit exceeded
code - 88
Relevant discussions can be found on the Internet at:
    http://www.google.co.jp/search?q=506c3b98 or
    http://www.google.co.jp/search?q=102a9b47
TwitterException{exceptionCode=[506c3b98-102a9b47], statusCode=429, message=Rate limit exceeded, code=88, retryAfter=-1, rateLimitStatus=RateLimitStatusJSONImpl{remaining=0, limit=180, resetTimeInSeconds=1424592304, secondsUntilReset=789}, version=4.0.2}
    at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:163)
    at twitter4j.HttpClientBase.request(HttpClientBase.java:53)
    at twitter4j.HttpClientBase.get(HttpClientBase.java:71)
    at twitter4j.TwitterImpl.get(TwitterImpl.java:1538)
    at twitter4j.TwitterImpl.search(TwitterImpl.java:244)
    at tweet4jtest.TweetManager.getTweets(TweetManager.java:23)
    at tweet4jtest.Tweet4jtest.main(Tweet4jtest.java:9)

最佳答案

有很多方法可以避免受费率限制:


您可以调整搜索结果:



  如果您的应用程序监视大量的搜索词,则对没有结果的搜索的查询要少一些。通过使用退避,您可以保持流行查询的最新状态,而不会浪费周期来请求很少更改的查询。或者,考虑使用The Streaming API并根据您的搜索条件进行过滤。



如果您希望大量使用API​​,请将响应存储在您的应用程序或网站中。
优先考虑活动用户
...


有关更多详细信息:https://dev.twitter.com/rest/public/rate-limiting

希望对您有所帮助。

关于java - Twitter4j超出了速率限制,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28656382/

10-10 19:34