Home>

I would like to create a system that retrieves and displays tweets from hashtag searches with Ruby on rails.

Rate limit exceeded
source code:
# app/controllers/tweets_controller.rb
class TweetsController<ApplicationController
  def show
    @tweets = TwitterClient.get_client.search ("# Cold today", count: 2, lang: "ja", since_id: 0)
  end
end

# show.html.erb
<div>
  <% = @ tweets.tweet.each do | tweet |%>
  <% = tweet.text%>
 <% = end%>
</div>
Try it

The number of tweets to be acquired is specified as "2" so that the limit is not caught, but an API Rate Limit error message appears.
What's the reason?

  • Answer # 1

    It is the number of times, not the number of acquired cases, that gets caught in the limit. Is this process called many times somewhere? There are sites that have Japanese translations for restrictions, so please check.
    http://westplain.sakuraweb.com/translate/twitter/Documentation/REST-APIs/Public-API/API-Rate-Limits.cgi