Search code examples
pythondjangopython-twitter

Python Twitter - Get tweet URLS


I am using the python-twitter module to get my most recent twitter status updates:

for i in range(0, limit):
        tweet = twitter.Api().GetUserTimeline(TWITTER_USERNAME)[i]
        tweet.date = datetime.strptime( tweet.created_at, "%a %b %d %H:%M:%S +0000 %Y" )
        tweets.append(tweet)

It's working fine, but the tweet.text property does not wrap the URL in a tags so they are clickable. I had a look through the python-twitter documentation but it doesn't give any specific advise on getting a status with the URLs as clickable urls.

I'm sure there is a function in the library to do this, does anyone know how?


Solution

  • You'll likely have to parse the text to find and mark up the URLs yourself. Here's a question about that:

    What's the cleanest way to extract URLs from a string using Python?