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);
Paging paging = new Paging(pageNumber, PAGE_SIZE); try { String page = "" + pageNumber;
/** * Returns the 20 most recent statuses posted in the last 24 hours from the authenticating user. * <br>This method calls http://twitter.com/statuses/friends_timeline * @param page int * @param listener a listener object that receives the response * @deprecated Use getFriendsTimelineAsync(Paging paging, TwitterListener listener) instead * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-friends_timeline">Twitter API Wiki / Twitter REST API Method: statuses friends_timeline</a> */ public void getFriendsTimelineByPageAsync(int page, TwitterListener listener) { getFriendsTimelineAsync(new Paging(page),listener); } /**
/** * Returns the 20 most recent statuses posted in the last 24 hours from the authenticating user. * <br>This method calls http://twitter.com/statuses/friends_timeline * @param sinceId Returns only statuses with an ID greater than (that is, more recent than) the specified ID * @param listener a listener object that receives the response * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-friends_timeline">Twitter API Wiki / Twitter REST API Method: statuses friends_timeline</a> * @deprecated Use getFriendsTimelineAsync(Paging paging, TwitterListener listener) instead */ public void getFriendsTimelineAsync(long sinceId, TwitterListener listener) { getFriendsTimelineAsync(new Paging(sinceId), listener); }
/** * Returns the 20 most recent replies (status updates prefixed with @username) to the authenticating user. Replies are only available to the authenticating user; you can not request a list of replies to another user whether public or protected. * <br>This method calls http://twitter.com/statuses/mentions * @param sinceId Returns only statuses with an ID greater than (that is, more recent than) the specified ID * @param listener a listener object that receives the response * @since Twitter4J 1.1.8 * @deprecated Use getMentionsAsync(Paging paging, TwitterListener listener) instead * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-mentions">Twitter API Wiki / Twitter REST API Method: statuses mentions</a> */ public void getRepliesAsync(long sinceId, TwitterListener listener) { getMentionsAsync(new Paging(sinceId), listener); }
/** * Returns the 20 most recent replies (status updates prefixed with @username) to the authenticating user. Replies are only available to the authenticating user; you can not request a list of replies to another user whether public or protected. * @param page int * @param listener a listener object that receives the response * @deprecated Use getMentionsAsync(Paging paging, TwitterListener listener) instead * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-mentions">Twitter API Wiki / Twitter REST API Method: statuses mentions</a> */ public void getRepliesByPageAsync(int page, TwitterListener listener) { getMentionsAsync(new Paging(page), listener); }
protected Paging getPaging(int page, int count, long sinceId) { Paging paging = new Paging(page, count); if (sinceId > 0) { paging.setSinceId(sinceId); } return paging; }
@Override public ResponseList<Status> getUserTimeline() throws TwitterException { return getUserTimeline(new Paging()); }
/** * Returns a list of the direct messages sent to the authenticating user. * <br>This method calls http://twitter.com/direct_messages * @param page int * @param listener a listener object that receives the response * @deprecated Use getDirectMessagesAsync(Paging paging, TwitterListener listener) instead * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-direct_messages">Twitter API Wiki / Twitter REST API Method: direct_messages</a> */ public void getDirectMessagesByPageAsync(int page, TwitterListener listener) { getDirectMessagesAsync(new Paging(page), listener); }
/** * Returns a list of the direct messages sent to the authenticating user. * <br>This method calls http://twitter.com/direct_messages * @param sinceId int * @param listener a listener object that receives the response * @deprecated Use getDirectMessagesAsync(Paging paging, TwitterListener listener) instead * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-direct_messages">Twitter API Wiki / Twitter REST API Method: direct_messages</a> */ public void getDirectMessagesAsync(int sinceId, TwitterListener listener) { getDirectMessagesAsync(new Paging((long)sinceId), listener); }
/** * Returns the most recent statuses posted in the last 24 hours from the authenticating user. * <br>This method calls http://twitter.com/statuses/user_timeline * @param sinceId Returns only statuses with an ID greater than (that is, more recent than) the specified ID * @param listener a listener object that receives the response * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-user_timeline">Twitter API Wiki / Twitter REST API Method: statuses user_timeline</a> * @since Twitter4J 2.0.0 * @deprecated Use getUserTimelineAsync(Paging paging, TwitterListener listener) instead */ public void getUserTimelineAsync(long sinceId, TwitterListener listener) { getUserTimelineAsync(new Paging(sinceId), listener); }
/** * Returns the specified user's friends, each with current status inline. * <br>This method calls http://twitter.com/statuses/friends * @param page number of the page to retrieve friends * @param listener a listener object that receives the response * @deprecated Use getFriendsStatusesAsync(Paging paging,TwitterListener listener) instead * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses%C2%A0friends">Twitter API Wiki / Twitter REST API Method: statuses%C2%A0friends</a> */ public void getFriendsAsync(int page,TwitterListener listener) { getFriendsStatusesAsync(new Paging(page), listener); }
/** * Returns a list of the direct messages sent by the authenticating user. * <br>This method calls http://twitter.com/direct_messages/sent * @param sinceId returns only sent direct messages with an ID greater than (that is, more recent than) the specified ID * @param listener a listener object that receives the response * @deprecated Use getSentDirectMessagesAsync(Paging paging, TwitterListener listener) instead * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-direct_messages%C2%A0sent">Twitter API Wiki / Twitter REST API Method: direct_messages%C2%A0sent</a> */ public void getSentDirectMessagesAsync(int sinceId, TwitterListener listener) { getSentDirectMessagesAsync(new Paging((long) sinceId), listener); }
/** * Returns the 20 most recent statuses posted in the last 24 hours from the authenticating user. * <br>This method calls http://twitter.com/statuses/friends_timeline * @param sinceId Returns only statuses with an ID greater than (that is, more recent than) the specified ID * @param page int * @param listener a listener object that receives the response * @since Twitter4J 1.1.8 * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-friends_timeline">Twitter API Wiki / Twitter REST API Method: statuses friends_timeline</a> * @deprecated Use getFriendsTimelineAsync(Paging paging, TwitterListener listener) instead */ public void getFriendsTimelineAsync(long sinceId, int page, TwitterListener listener) { getFriendsTimelineAsync(new Paging(page,sinceId),listener); }
@Override public void getUserTimeline(final long userId) { getUserTimeline(userId, new Paging()); }
/** * Returns the 20 most recent statuses posted in the last 24 hours from the authenticating user. * <br>This method calls http://twitter.com/statuses/friends_timeline * @param page int * @param listener a listener object that receives the response * @since Twitter4J 1.1.8 * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-friends_timeline">Twitter API Wiki / Twitter REST API Method: statuses friends_timeline</a> * @deprecated Use getFriendsTimelineAsync(Paging paging, TwitterListener listener) instead */ public void getFriendsTimelineAsync(int page, TwitterListener listener) { getFriendsTimelineAsync(new Paging(page),listener); }
/** * Returns the authenticating user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed). * <br>This method calls http://twitter.com/statuses/followers * @param page Retrieves the next 100 followers. * @param listener a listener object that receives the response * @since Twitter4J 1.1.0 * @deprecated Use getFollowersStatusesAsync(Paging paging, TwitterListener listener) instead * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses%C2%A0followers">Twitter API Wiki / Twitter REST API Method: statuses%C2%A0followers</a> */ public void getFollowersAsync(int page, TwitterListener listener) { getFollowersStatusesAsync(new Paging(page), listener); }
protected Paging getLastIdPaging() { Integer pages = endpoint.getProperties().getNumberOfPages(); Integer count = endpoint.getProperties().getCount(); if (pages != null && count != null) { return new Paging(pages, count, lastId); } else if (pages != null) { return new Paging(pages, lastId); } else { return new Paging(lastId); } } }
/** * Returns the most recent statuses posted in the last 24 hours from the specified user id. * <br>This method calls http://twitter.com/statuses/user_timeline * @param id String * @param count int * @param listener a listener object that receives the response * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-user_timeline">Twitter API Wiki / Twitter REST API Method: statuses user_timeline</a> * @deprecated Use getUserTimelineAsync(String id, Paging paging, TwitterListener listener) instead */ public void getUserTimelineAsync(String id, int count, TwitterListener listener) { getUserTimelineAsync(id, new Paging().count(count), listener); }
Twitter tw = new TwitterFactory().getInstance(); // some userlist UserList userList = tw.getUserLists("screen name", -1).get(0); System.out.println(userList.getName()); int listId = userList.getId(); ResponseList<Status> userListStatuses = tw.getUserListStatuses(listId, new Paging(1)); for (Status status : userListStatuses) { System.out.println(status.getText()); }