Reputation: 870
How do I get the number of retweets for statuses on my timeline for Twitter4j (latest version). That is:
Status - retweet count to be outputted?
Upvotes: 2
Views: 1194
Reputation: 1727
As far as I understand, you wanna know how many retweet counts each status has, right. There is a method that can be reached via status object to get the actual retweet count of a tweeet.
Look at the following simple code which is printing the tweet id and retweet count for each tweet in the timeline for a given user id:
long userId = 0000000L;
try
{
ResponseList<Status> statusList = twitterObj.timelines().getUserTimeline(userId);
for (Status statusItem : statusList)
{
System.out.println("Tweet Id : " + statusItem.getId() + ", retweet count: " + statusItem.getRetweetCount());
}
}
catch (TwitterException ex)
{
// Do error handling things here
}
Upvotes: 1