Search code examples
rubytwitter-gem

How do I use the Ruby twitter gem to get a list of followers for a given ID/handle?


I want to use v5.0 of the Twitter gem, and I can't figure out the documentation to understand how to get a list of followers, given a handle.

It looks like previous versions had a method that looked something like Twitter.follower_ids('ID to lookup'), but that doesn't work any more.


Solution

  • I don't know if there's some easier way to navigate the RDoc documentation but I had to first root around in the code, to notice the RDoc comments, to then realize that this is the page which documents some of the behavior I wanted.

    # configure client with secrets and access keys client.followers 'screen_name_of_interest'

    This returns a certain number of followers - but I still can't figure out how to figure out how many followers, and how to use cursors to retrieve more.