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.
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.
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
}