Friends list of a friend using Twitter4J

前端 未结 7 897
旧时难觅i
旧时难觅i 2021-01-12 23:40

How can I obtain the friends list of a friend or follower using Twitter4J?

Using getFriendsId(), I\'m only able to retrieve the friend\'s/follower\'s list of that cu

7条回答
  •  情话喂你
    2021-01-13 00:39

    This will show the name of your friend's followers.

          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);
    

提交回复
热议问题