twitter follower

Asked 2 years ago, Updated 2 years ago, 70 views

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
}

ruby

2022-09-30 20:48

1 Answers

You can not get 30000+ users without interval.
Maybe rate_limit.reset_inwill aid.

By the way...
client.followers called API by each 20 (Max:200) users[1].
but
client.follower_idscan get 5,000 Ids[2] and client.userscan 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.


2022-09-30 20:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.