【问题标题】:The number of re-tweets for twitter4jtwitter4j 的转发次数
【发布时间】:2014-03-07 05:06:43
【问题描述】:

如何获取 Twitter4j(最新版本)时间线上状态的转发次数。那就是:

状态 - 要输出的转发计数?

【问题讨论】:

    标签: java twitter twitter4j


    【解决方案1】:

    据我了解,您想知道每个状态有多少转推数,对吧。有一种方法可以通过状态对象来获取推文的实际转发计数。

    查看以下简单代码,该代码为给定用户 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
         }
    

    【讨论】:

      猜你喜欢
      • 2020-02-22
      • 1970-01-01
      • 2016-08-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-25
      • 2011-09-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多