How to retrieve tweet text and creater hyperlink if text has an URL?

Nov 3, 2014 at 4:13 PM
The tweet Text returns plain text and it has no ability for the hyperlinks. How can I manipulate the tweet if it has a URL so it can be clicked and open up a new window?
Coordinator
Nov 3, 2014 at 4:37 PM
Hi,

The ITweet interface has property called Entities and ExtendedEntities.
They both contains another property called URLs, which is a list of URLs detected by Twitter.

Each of these URLs contains additional information. One of which is called Indices. It is composed of 2 integers which represent the start and end of the URL within the Tweet message.

Please let me know if you need additional information.
Linvi
Nov 3, 2014 at 4:48 PM
Thank you for your prompt response linvi.
In order to get the tweet text, I use Text property of Tweet object. How can I access Extended entities with the text and its urls with the hyperlinks?
Coordinator
Nov 3, 2014 at 11:40 PM
Hi again,

I am not sure how I can help you more than what I told you. Maybe some code will help?
var tweet = Tweet.PublishTweet("I think https://tweetinvi.codeplex.com is awesome");
var URLsContainedInTweet = tweet.Entities.Urls;
var tweetinviCodeplexComURL = URLsContainedInTweet[0];
var startingPositionOfURLInTweet = tweetinviCodeplexComURL.Indices[0];
var endingPositionOfURLInTweet = tweetinviCodeplexComURL.Indices[1];
Linvi
Editor
Nov 4, 2014 at 9:42 AM
Another way would be using regex to parse urls in the tweet text and replacing them with hyperlink html code. It should be fairly easy to parse urls as all urls in Tweet.Text would be t.co urls.

imlokesh