I'm creating an application that consumes the twitter api. I'm retrieving the tweet's and showing users.
In some cases tweets have links, as you can see in the image below.
Reading the api documentation for twitter, I found something called "Enhanced URLs enrichment" that includes the link metadata, containing image url, title, description.
See an example of response I want to get
{
"urls": [
{
"url": "https://exampleurl.com/D0n7a53c2l",
"expanded_url": "http://exampleurl.com/18gECvy",
"display_url": "exampleurl.com/18gECvy",
"unwound": {
"url": "https://www.youtube.com/watch?v=oHg5SJYRHA0",
"status": 200,
"title": "RickRoll'D",
"description": "http://www.facebook.com/rickroll548 As long as trolls are still trolling, the Rick will never stop rolling."
},
"indices": [
62,
85
]
}
]
}
Attention to the object unwound it contains exactly what I need. You can find the above response in the documentation here:
And more about Enhanced URLs enrichment here
I'm retrieving tweets by the endpoint GET statuses/user_timeline
This is my code for retrieving tweets with Twitter4j
final ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setOAuthConsumerKey(Constant.getConsumerKeyTwitter());
cb.setOAuthConsumerSecret(Constant.getConsumerSecretTwitter());
cb.setOAuthAccessToken(tokenUser);
cb.setOAuthAccessTokenSecret(secretTokenUser);
cb.setTweetModeExtended(true);
Twitter twitter = new TwitterFactory(cb.build()).getInstance();
List<Status> statuses = twitter.getUserTimeline(userIDToGetTweets);
Using this code, I cant receive the object unwound.
Do you know how I can enable Enhanced URLs enrichment to receive the object unwound