Ruby: Twitter API: Get All followers

Posted by user28871 on Stack Overflow See other posts from Stack Overflow or by user28871
Published on 2010-12-22T02:16:58Z Indexed on 2010/12/22 2:54 UTC
Read the original article Hit count: 272

Filed under:
|
|

Hi,

Anyone have any idea why the next cursor isn't changing in the below code?

cursor = "-1"
followerIds = []
while cursor != 0 do
 followers = Twitter.follower_ids("IDTOLOOKUP",{"cursor"=>cursor})

 cursor = followers.next_cursor
 followerIds+= followers.ids
 sleep(2)
end

After the first iteration where cursor = -1, it gets assigned the nextcursor from the twitter api. However, when this is sent to the twitter API on subsequent iterations, I get the same response back as I did the first time.. with the same next_cursor.

Any ideas what I'm doing wrong? I'm using the twitter gem.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about twitter