Get tweets of a public twitter profile

To use Twitter4J to get all posts from a user you’ll have to make your request over multiple pages..

Below code based of an example on GitHub

Twitter unauthenticatedTwitter = new TwitterFactory().getInstance();
//First param of Paging() is the page number, second is the number per page (this is capped around 200 I think.
Paging paging = new Paging(1, 100);
List<Status> statuses = unauthenticatedTwitter.getUserTimeline("google",paging);

Just loop and keep grabbing new pages until there are no new posts should work.

Leave a Comment