RinW
RinW

Reputation: 553

Extract tweet from URL using Java?

According to the things I've found twitter4J seems to be the most prominent tool when it comes to Java and Twitter. I went through the code examples and javadoc but I couldn't find a way to do this.

What I want to do is, extract the tweet (content of the tweet) using the URL of it. I tried using JSOUP and the CSS selector but when its a conversation it pulls all the tweets of it. How can I do it using Twitter4J?

Input tweet URL -> Output the content of the tweet

Upvotes: 0

Views: 402

Answers (1)

Amenallah Hsoumi
Amenallah Hsoumi

Reputation: 116

Using jsoup is easier, u can do this:

 Document doc = Jsoup.connect("the tweet url here").timeout(10*1000).get();
 Element tweet = doc.select(".js-tweet-text-container").first();

now u can use the tweet object to parse the information.

Upvotes: 1

Related Questions