How to get followers and following list screen names (Twitter4J)?

时间:2016-02-12 21:00:18

标签: java twitter twitter4j

I am trying to get my followers and following list via Twitter 4J. I pass the configuration builder from the main method as a parameter to the method.

Here is the code:

.wrapper {
  display: flex;
  justify-content: flex-end;
}

.flex-col-2 {
  display: flex;
  justify-content: flex-end;
}

.nested-col-1 {
  /* Overflow is for display purposes. It does not affect the bug. */
  overflow: hidden;
}

#percent-width {
  width: 0%;
}

#unit-width {
  width: 0px;
}

So far this only returns IDS but it does not return the screen name of the followers. Does anyone have any idea? I am working in Java and printing to the terminal.

Thanks.

1 个答案:

答案 0 :(得分:2)

String twitterScreenName = twitter.getScreenName();
PagableResponseList<User> statuse = twitter.getFollowersList(twitterScreenName, -1);
            for (User follower : statuse) {

                System.out.println(follower.getName()); 
            }
相关问题