

I want twitter's follower ID and follower Name.  
A User have fowllower have 30,000 or more.  
Error output 『Rate limit exceeded (Twitter::Error::TooManyRequests)』.

Please coached me.

[code]

    require "rubygems"
    require "twitter"
    
    target = "hogehoge"
    
    
    client = Twitter::REST::Client.new do |config|
        config.consumer_key = "XXXXX"
        config.consumer_secret = "XXXX"
        config.access_token = "XX-XXXX"
        config.access_token_secret = "XXXXX"
    end
    
    followers_list = client.followers(target)
    friends_list = client.friends(target)
    
    followers_list.each{|follower|
        puts follower.screen_name
        puts follower.name
    }
    
[/code]


CC BY-SA 3.0
2015-05-17T02:49:19.327
10275
2015-05-27T12:14:22.993
2015-05-17T03:57:47.980
3639
9766
question
ruby
twitter follower


## en

You can not get 30000+ users without interval.  
Maybe `rate_limit.reset_in` will aid it.

By the way...  
`client.followers` called API by each 20(Max:200) users[1].  
but  
`client.follower_ids` can get 5,000 Ids[2] and `client.users` can lookup 100
users [3]. -- I think better it.

## ja

30,000ユーザーを超えユーザー情報を、インターバル無しで取得することは、できません。  
おそらく`rate_limit.reset_in`が助けとなるでしょう。

ところで。  
`client.followers`は、20(最大200)ユーザー毎に、APIを呼び出します[1]。  
しかし  
`client.follower_ids`は、5,000のIDを取得できますし[2]。`client.users`は、100ユーザーの情報を、参照できます[3]。――
こっちのほうがより良いと思いますよ。

## see also

[1] <https://dev.twitter.com/rest/reference/get/followers/list>  
* 200users x 15(30)req / 15min = 3,000(6,000)users / 15min

vs.

[2] <https://dev.twitter.com/rest/reference/get/followers/ids>  
* 5,000IDs x 15(15)req / 15min = 7,500(7,500)IDs / 15min  
[3] <https://dev.twitter.com/rest/reference/get/users/lookup>  
* 100users x 180(60)req / 15min = 18,000(6,000)users / 15min.


CC BY-SA 3.0
2015-05-27T12:08:54.520
10690
2015-05-27T12:14:22.993
2015-05-27T12:14:22.993
8335
8335
10275
answer