Pregunta

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.

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top