简体   繁体   English

twitter4j转推的​​次数

[英]The number of re-tweets for twitter4j

How do I get the number of retweets for statuses on my timeline for Twitter4j (latest version). 如何在我的Twitter4j(最新版本)的时间轴上获取状态转发的数量。 That is: 那是:

Status - retweet count to be outputted? 状态-转推计数输出?

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: 看下面的简单代码,它为给定的用户ID在时间轴上打印每个推文的推文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
     }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM