collect: while (cursor != 0) { try { IDs ids = networkRelation == Networker.FOLLOWERS ? twitter.getFollowersIDs(screen_name, cursor) : twitter.getFriendsIDs(screen_name, cursor); RateLimitStatus rateStatus = ids.getRateLimitStatus(); if (networkRelation == Networker.FOLLOWERS) {
/** * Returns an array of numeric IDs for every user the authenticating user is following. * @return an array of numeric IDs for every user the authenticating user is following * @throws TwitterException when Twitter service or network is unavailable * @since Twitter4J 2.0.0 * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-friends%C2%A0ids">Twitter API Wiki / Twitter REST API Method: friends ids</a> */ public IDs getFriendsIDs() throws TwitterException { return getFriendsIDs(-1l); }
/** * Returns an array of numeric IDs for every user the specified user is following.<br> * all IDs are attempted to be returned, but large sets of IDs will likely fail with timeout errors. * @param userId Specfies the ID of the user for whom to return the friends list. * @return an array of numeric IDs for every user the specified user is following * @throws TwitterException when Twitter service or network is unavailable * @since Twitter4J 2.0.0 * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-friends%C2%A0ids">Twitter API Wiki / Twitter REST API Method: friends ids</a> */ public IDs getFriendsIDs(int userId) throws TwitterException { return getFriendsIDs(userId, -1l); }
/** * Returns an array of numeric IDs for every user the specified user is following. * @param screenName Specfies the screen name of the user for whom to return the friends list. * @return an array of numeric IDs for every user the specified user is following * @throws TwitterException when Twitter service or network is unavailable * @since Twitter4J 2.0.0 * @see <a href="http://apiwiki.twitter.com/REST-API-Documentation#friends/ids">Twitter API Wiki / REST API Documentation - Social Graph Methods - friends/ids</a> */ public IDs getFriendsIDs(String screenName) throws TwitterException { return getFriendsIDs(screenName, -1l); }
@Override public void invoke(List<TwitterListener> listeners) throws TwitterException { IDs ids = twitter.getFriendsIDs(userId, cursor); for (TwitterListener listener : listeners) { try { listener.gotFriendsIDs(ids); } catch (Exception e) { logger.warn("Exception at getFriendsIDs", e); } } } });
@Override public void invoke(List<TwitterListener> listeners) throws TwitterException { IDs ids = twitter.getFriendsIDs(screenName, cursor); for (TwitterListener listener : listeners) { try { listener.gotFriendsIDs(ids); } catch (Exception e) { logger.warn("Exception at getFriendsIDs", e); } } } });
@Override public void invoke(List<TwitterListener> listeners) throws TwitterException { IDs ids = twitter.getFriendsIDs(cursor); for (TwitterListener listener : listeners) { try { listener.gotFriendsIDs(ids); } catch (Exception e) { logger.warn("Exception at getFriendsIDs", e); } } } });
IDs list = twitter.getFriendsIDs(0); for(long ID : list.getIDs()) { Status[] tweets = getAllTweets(twitter, ID); System.out.println(ID + ": " + tweets.length); } Status[] getAllTweets(Twitter twitter, long userId) { int pageno = 1; List statuses = new ArrayList(); while (true) { try { int size = statuses.size(); Paging page = new Paging(pageno++, 100); statuses.addAll(twitter.getUserTimeline(userId, page)); if (statuses.size() == size) break; } catch (TwitterException e) { e.printStackTrace(); } } return (Status[]) statuses.toArray(new Status[0]); }
int finish = 100; ArrayList<Long> IDS = new ArrayList<Long>(); long[] friendsID = t.getFriendsIDs(userID, -1).getIDs(); boolean check = true; while (check) {