How to get the date of each twitter favorite using twitter4j

Viewed 57

Trying to get the date of each twitter favorite Using the following code:

TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); for (Status rt : twitter.getFavorites()) { System.out.println(rt); }

but it returns a Status object with the data of the tweet and just the count of the favorite on that tweet

1 Answers

Not sure if this is the solution but there is a method in the Status interface called getCreatedAt(). So you could try this:

TwitterFactory tf = new TwitterFactory(cb.build()); 
Twitter twitter = tf.getInstance(); 
for (Status rt : twitter.getFavorites()) { 
System.out.println(rt.getCreatedAt().toString(); 
}

Source: http://twitter4j.org/oldjavadocs/4.0.0/index.html

Package: twitter4j -> Status (link isn't linking directly to the source)

Related