I am new to twitter4j. How i can get media related info using twitter4j library? I want to get info about photos,videos and article summary present in tweet.Thanks in advance.Is
Yes Status#getMediaEntities()
is what you want but you can only get basic information about the media contained in the Tweet. For example if you wanted to search for Tweets matching a criteria and get media entities' types and URLs you could do:
Twitter twitter = TwitterFactory.getSingleton();
Query query = new Query("...");
QueryResult result = twitter.search(query);
for (Status status : result.getTweets()) {
for (MediaEntity mediaEntity : status.getMediaEntities()) {
System.out.println(mediaEntity.getType() + ": " + mediaEntity.getMediaURL());
}
}
There are other methods of retrieving Tweets using Twitter4J, e.g. using the Streaming API, take a look at the code examples on the Twitter4J web site for more information.