Hi guys,
I’m working on a project which analyses closure patterns in social networks.
Part of my requirement is to collect followers and following IDs of thousands of users under scrutiny.
I have a problem with rate limit exceeding 350 requests/hour.
With just 4-5 requests my limit is exceeding - ie, when the number of followers I collected exceeds the 350 mark.
ie, if I have 7 members each having 50 followers, then when I collect the follower details of just 7 members, my rate exceeds.(7*50 = 350).
But my requirements involves collecting the follower-following details of close to 16,000 members.
How can I achieve this? Why is each follower of a user treated as a separate request?
I expected collecting the followers of a member means 1 request… Can I get this behavior some how?
I’ve shown part of the code below… It is directly taken from the examples provided with twitter4j.
It runs perfectly fine until the the number of followers collected > 350.
(And if a single user has more than 350 followers, again this fails to run)
<standard oauth authentication code>
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
long cursor = -1;
IDs ids;
User user;
System.out.println("Listing following ids.");
do {
ids = twitter.getFollowersIDs(username, cursor);
for (long id : ids.getIDs()) {
user = twitter.showUser(id);
if (!userFollowerNames.contains(user.getScreenName())) {
userFollowerNames.add(user.getScreenName());
}
//System.out.println(id);
}
} while ((cursor = ids.getNextCursor()) != 0);
error-
“Failed to get list members: 400:The request was invalid. An accompanying error message will explain why. This is the status code will be returned during rate limiting (https://dev.twitter.com/pages/rate-limiting).
error - Rate limit exceeded. Clients may not make more than 350 requests per hour.”