tags:

views:

2100

answers:

3

I need to periodically return a list of all new followers of a twitter account (i.e. since the last time the list of followers was retrieved), but the Twitter API only seems to provide functionality for getting a list of all current followers of the account.

Apart from getting this full list every time and comparing it against a stored version of the last time it was retrieved, is there any other way to get hold of the new followers?

Sites such as divvoted.com, mrtweet etc must do this somehow! Am I missing something or does it just need the round-the-houses approach described above?

+8  A: 

Yes, you have to keep the list of followers since last update, because twitter does not associate api clients to state. The definition of 'last time the list was retrieved' lacks 'by whom'.

Jan Jungnickel
Thanks Jan, i guess what I was looking for is a 'get new followers since (timestamp)' and a 'get users who have unfollowed since (timestamp)' so i didn't need to go through the whole list. That way there wouldn't need to be any client/state issues.
Mark Perkins
A: 

You always can try to catch the mails from Twitter with the message: "... is following you on Twitter". This might be a bit harder than using the Twitter API and there is a chance of missing mails (in case mails are not delivered), but it will safe some valuable API calls. But this does not cover unfollowing...

If you try to do it the way you described yourself. The Twitter API returns the followers in order of "newer follower first", so on the first hit (a follower listed in your stored version of the list) you can stop looking for new followers.

To1ne
A: 

To1Ne is right. In addition check out the twitter api to learn how to use the "cursor" function.

Debt Man