Twitter friends timeline not returning full history

Posted by twofivesevenzero on Stack Overflow See other posts from Stack Overflow or by twofivesevenzero
Published on 2010-06-17T19:22:14Z Indexed on 2010/06/17 21:13 UTC
Read the original article Hit count: 161

Filed under:
|

I am using twitter4J to get a user's friends timeline, but it is not returning the full available history. I know there are pagination limits (200 per request and 3200 total as per http://bit.ly/ck8ysq) and I am well within those. I make a request like so:

private static final int MAX_COUNT = 200;

private List<Status> getAllStatuses(long sinceID) throws TwitterException {
    Twitter twitter = new Twitter(username, password);
    List<Status> friendsTimelineList = new ArrayList<Status>();
    List<Status> tempList;

    int page = 0;
    do {
        page++;
        tempList = twitter.getFriendsTimeline(
                             new Paging(page, MAX_COUNT, sinceID));
        if(tempList == null )
            break;
        friendsTimelineList.addAll(tempList);
    } while(true);

    return friendsTimelineList;
}

This results in only 423 statuses being returned across 3 pages. Any idea why this might be happening?

© Stack Overflow or respective owner

Related posts about java

Related posts about twitter-api