简体   繁体   English

Twitter4j,回复一条推文

[英]Twitter4j, replies to a tweet

Can someone please provide me a method to gel all replies to a given status using Twitter4j? 有人可以给我提供一种使用Twitter4j将所有回复汇总到给定状态的方法吗? I've searched a lot but all I could find is this question but I'm not able to use it. 我已经搜索了很多,但是我只能找到这个问题,但是我无法使用它。

This simply tells me that given a status AI can get the status B if A is a reply to B. But what if I only have B? 这只是告诉我,如果A是对B的答复,那么给定状态AI可以得到B状态。但是如果我只有B会怎样?

Although this question is a year old now, I've stumbled on it while having developed a solution requested over here: 尽管这个问题已经存在一年了,但在这里开发出一个所需的解决方案时,我却迷失了它:

You need to grab users timelines and users mentions 您需要抓住用户的时间表和用户提及

 TwitterInstance.getUserTimeline(pageno);
 TwitterInstance.getMentionsTimeline(pageno);

and store returned status' in an Arraylist. 并将返回的状态存储在Arraylist中。

  ArrayList<twitter4j.Status> statusList= new ArrayList<twitter4j.Status>();

Then you may search for you B from above and with that you can iterate through the status list with id and inReplyTo , building up the tree in memory. 然后,您可以从上方搜索B ,然后可以使用idinReplyTo遍历状态列表, inReplyTo在内存中建立树。

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

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