这是我的代码:
int favouritesCount = user.getFavouritesCount();
int followersCount = user.getFollowersCount();
int friendsCount = user.getFriendsCount();
long userId = user.getId();
System.out.println("FavouritesCount: " + favouritesCount + ", followersCount: " + followersCount + ", friendsCount: " + friendsCount);
ArrayList<User> followers = new ArrayList<User>();
long nextCursor = 0;
do {
PagableResponseList<User> usersResponse = twitter.getFollowersList(user.getScreenName(), nextCursor);
System.out.println("size() of first iteration:" + usersResponse.size());
nextCursor = usersResponse.getNextCursor();
followers.addAll(usersResponse);
} while ( nextCursor > 0);
System.out.println( followers.size() > 0 ? "Getting followers:" : "No followers.");
for ( User user : followers) {
System.out.println(user.getScreenName() + ", id: " + user.getId());
}
这是我得到的输出:
FavouritesCount: 0, followersCount: 1, friendsCount: 1
size() of first iteration:0
No followers.
我在这里做错了什么?用户通过 OAuth 进行身份验证,一切都很好,除了这部分代码根本不起作用。正确的是追随者和朋友的数量,但我看到追随者有问题。
请帮忙!
最好的,D