I want twitter's follower ID and follower Name.
A User have flower have 30,000 or more.
Error output Rate limit exceeded (Twitter::Error::TooManyRequests).
Please coached me.
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
}
You can not get 30000+ users without interval.
Maybe rate_limit.reset_in
will aid.
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.
More than 30,000 users cannot be retrieved without an interval.
The rate_limit.reset_in
will probably help.
By the way.
client.followers
invokes the API for each 20 (up to 200) user [1].
However
client.follower_ids
can get 5,000 IDs, and client.users
can view information for 100 users [3].-- I think this is better.
[1]https://dev.twitter.com/rest/reference/get/followers/list
* 200 users x 15(30) req / 15min = 3,000(6,000) users / 15min
vs.
[2] https://dev.twitter.com/rest/reference/get/followers/ids
* 5000 IDs x 15(15)req/15min = 7,500(7,500) IDs/15min
[3] https://dev.twitter.com/rest/reference/get/users/lookup
* 100 users x 180(60)req/15min = 18,000(6,000) users/15min.
© 2024 OneMinuteCode. All rights reserved.