I'm using the following code to retrieve all follower_ids:
def followers_ids
follower_ids = []
next_cursor = -1
while next_cursor != 0
cursor = @client.follower_ids("USERNAME", :cursor => next_cursor)
follower_ids.concat(cursor.take(5000))
next_cursor = cursor.next_cursor
end
follower_ids
end
Rather than hard coding the 5000 count, I'd like to use something as simple as `cursor.all` (no all method in enumerable). Using `to_a` or `count` seem to make extra requests and hit the rate limit. Any suggestions?
Also, after doing some research regarding rate limiting, it seems that the suggested practice is to rescue from rate limit error. Is this still suggested if I plan on hitting the rate limit frequently? I don't want to get flagged by Twitter. As an alternative, I'm thinking I might manually count the requests and background delay the ones that would trigger a rate limit error.