I am trying to find out all the followers of a given user. I find the following code:
User u1 = null ;
long cursor = -1;
IDs ids;
System.out.println("Listing followers's ids.");
do {
ids = twitter.getFollowersIDs("NZ_Football", cursor);
for (long id : ids.getIDs()) {
System.out.println(id);
User user = twitter.showUser(id);
System.out.println(user.getName());
}
} while ((cursor = ids.getNextCursor()) != 0);
The piece of code works perfectly for me. However, I have questions:
@1. The cursor value is a kind of flag if it is -1, that means there are still some followers of a particular user. The twitter API uses this cursor mechanism because it returns a set of follower IDs for each loop.
@2. Yes, but you can figure out this issue. You can create several twitter account to generate some new token stuff. Then, you can implement a mechanism that renews the token whenever rate limit shows up.
@3. It returns the cursor value of the new set of follower IDs. As far as I remember, it returns 50000 IDs per loop.
I hope I replied all you want to know well.