简体   繁体   中英

How to get a retweet text message using Twitter4j library

I am new to Twitter4j library. I need to get all the retweets of a tweet. To do this I have written this java code:

try {
    Twitter twitter = tf.getInstance();
    List<Status> statuses = twitter.getRetweets(Long.parseLong(id));
    System.out.println(statuses.size());

    for (Status status : statuses) {
        System.out.println("@" + status.getUser().getScreenName() + " - " + status.get);
    }
} catch{
    some code...
}

tf is a variable I declared as

tf = new TwitterFactory(configuration);

and includes the information about the configuration. When I run the code the output I get is

@rssmiranda - RT @repubblicait: Tokyo, una corona per Edymar: è la miss   delle miss

As you can see we have on the left the info about the user but on the right we have the message of the general tweet, not the message included in the retweet written by the user. How can I display the retweet written by (for example) @rssmiranda? Thanks!!!!!

For showing number of retweet:

https://api.twitter.com/1/statuses/show.json?id=<id>

It will give you the answer like -

"retweet_count": 1 etc.

For all the details of retweet read this : GET statuses/retweets/:id

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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