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)

# show.html.erb
  <% = @ tweets.tweet.each do | tweet |%>
  <% = tweet.text%>
 <% = end%>
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.