Get total followers count query

512 views
Skip to first unread message

Rajat Chowdhary

unread,
Oct 22, 2013, 8:01:56 AM10/22/13
to twitter-...@googlegroups.com
Hey!Guys,

Need a help. When I do a client.followers, it returns me the list of all followers(upto 5000) and cursor value specifying if there is a next page or not?
Two things:

1. Would it be possible to just get the count of followers rather than the list?
2. If the cursor value is positive, indicating that I have more than 5k followers, how do I make another call to get the followers on the second page?

Any help is greatly appreciated and is much needed :)

Thanks, 

Steve Agalloco

unread,
Oct 23, 2013, 3:01:52 PM10/23/13
to twitter-...@googlegroups.com
Follower count is returned as part of the user/show endpoint: https://dev.twitter.com/docs/api/1.1/get/users/show

Through the gem, you can access the followers_count on Twitter::User like so:

client = Twitter::Client.new({})
me = client.user('anno')
me.followers_count

Much easier that iterating over all the followers. 

Rajat Chowdhary

unread,
Oct 23, 2013, 8:32:56 PM10/23/13
to twitter-...@googlegroups.com
I got that figured out!! Many thanks, Steve. 


--
You received this message because you are subscribed to a topic in the Google Groups "Twitter Ruby Gem" group.
To post to this group, send email to twitter-...@googlegroups.com.
Visit this group at http://groups.google.com/group/twitter-ruby-gem.

Reply all
Reply to author
Forward
0 new messages