Twitter4j:得到的答复名单一定鸣叫 [英] Twitter4j: Get list of replies for a certain tweet

查看:151
本文介绍了Twitter4j:得到的答复名单一定鸣叫的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时有可能得到的回复鸣叫(或其回复)使用twitter4j鸣叫的名单? Twitter网站和Android应用程序有此功能。

Is it possible to get a list of tweets that reply to a tweet (or to its replies) using twitter4j? The twitter website and Android app have this feature.

推荐答案

下面是一个code,我使用 welshare

Here's a code I'm using in welshare

第一部分得到所有的Twitter是显示鸣叫下面的鸣叫,打开时。其余的照顾谈话,以防鸣叫是一些其他的鸣叫的答复。

The first part gets all the tweets that twitter is displaying below the tweet, when it is opened. The rest takes care of conversations, in case the tweet is a reply to some other tweet.

RelatedResults results = t.getRelatedResults(tweetId);
List<Status> conversations = results.getTweetsWithConversation();
/////////
Status originalStatus = t.showStatus(tweetId);
if (conversations.isEmpty()) {
    conversations = results.getTweetsWithReply();
}

if (conversations.isEmpty()) {
    conversations = new ArrayList<Status>();
    Status status = originalStatus;
    while (status.getInReplyToStatusId() > 0) {
        status = t.showStatus(status.getInReplyToStatusId());
        conversations.add(status);
    }
}
// show the current message in the conversation, if there's such
if (!conversations.isEmpty()) {
    conversations.add(originalStatus);
}

编辑:这不会工作了,因为Twitter的API -V 1现在是不是在用

This wont work anymore as Twitter API v 1 is now not in use

这篇关于Twitter4j:得到的答复名单一定鸣叫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆