1

I am using the twitter4j library to collect some data in twitter. There is an interface called Status which can be used to get various information about a tweet (such as id, location, time, whether it was a retweet...). I am currently interested in retrieving the id of a user that is being retweeted in a tweet. For example, suppose John retweets samantha and suppose I have John's tweet; let's call John's tweet t

I would like to do something in code like:

Long retweetedUserID = t.getRetweetedUserID();

I find the javadoc very unclear and cannot properly discern the meaning of each function.

  1. Does anybody know how to get the user id of the person that is being retweeted?

I posted a similar question here about the meaning of a particular method in the Status interface that I believe is related to this problem.

All help is greatly appreciated.

4

1 に答える 1

6

Use the method getRetweetedStatus(). You can store this into a Status variable and then user the getUser() method. Altogether this is:

for(Status t : results.getTweets())
{
    retweetedStatus = t.getRetweetedStatus();
    User curRTUser = retweetedStatus.getUser();
    curRTUserID = curRTUser.getId();
    //do whatever you want
}
于 2013-01-05T23:27:41.633 に答える