I am using twitter4j to search and display tweets. Here is the code snippet
query query = new query (queryString); Query result result = twitter.search (query); (For Tweet Tweet: result.getTweets ()) {System.out.pritnln (tweet.getFromUser () + ":" + + Tweet.getText ()); } Here tweet.getText () returns plain text without anchor tag (plain text not html) even though it has hashtags and URLs on some websites. To see Twitter as a Twitter search result, how can I get Twitter text with anchor tag?
You use methods to get hashtags and URLs from each tweet. And there are two ways in the classes that tell you how the unit starts and ends in the text of the tweet, so when you display the tweet, you can use that information to insert link markup.
The example code that removes the URLs of recent tweets:
twitter Twitter = new TwitterFiner (). GetInstance (); Query query = new query ("lizards"); Query result result = twitter.search (query); (For Tweet Tweet: result.getTweets ()) {System.out.println (tweet.getFromUser () + ":" + + Tweet.getText ()); (For urltl URL: tweets. Jalemettius ()) {System.out.println (urle.getDisplayURL ()); }}
Comments
Post a Comment