How to get my followers list [closed]

2019-09-25 04:23发布

问题:

I couldn't find any best solution for getting Twitter followers list.

Could anyone just provide me code example for this. I couldn't understand how to do this after reading twitter documentation.

There is twitter.getFollowersList(String, long) method but I can't find how to use it.

回答1:

User u1 = null ;
      long cursor = -1;
      IDs ids;
      System.out.println("Listing followers's ids.");
      do {
              ids = twitter.getFollowersIDs("username", cursor);
          for (long id : ids.getIDs()) {
              System.out.println(id);
              User user = twitter.showUser(id);
              System.out.println(user.getName());
          }
      } while ((cursor = ids.getNextCursor()) != 0);

Take a look: Friends list of a friend using Twitter4J