Anyone have any idea why the next cursor isn't changing in the below code?
cursor = "-1"
followerIds = []
whi开发者_JAVA百科le 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.
Edit: [Suggestion regarding being rate limited removed]
The problem is the cursor option to follow_ids. It should read:
followers = Twitter.follower_ids("IDTOLOOKUP",{:cursor=>cursor})
Note the use of symbol, not string. In the original code, the "cursor" option being provided was being ignored and follower_ids was doing the default behavior, namely returning the first page of followers.
精彩评论