int i = 1;
while (true) {
YouTubeQuery query = new YouTubeQuery(url);
query.setMaxResults(MAX_RESULTS);
query.setStartIndex(i);
FriendFeed feed = serv.query(query, FriendFeed.class);
for (FriendEntry entry : feed.getEntries()) {
friends.add(entry.getUsername());
}
i += MAX_RESULTS;
if (i > feed.getTotalResults()) {
break;
}
}
} catch (Exception ex) {
ex.printStackTrace();