开发者

Python Twitter - Get tweet URLS

开发者 https://www.devze.com 2023-02-25 15:20 出处:网络
I am using the python-twitter module to get my most recent twitter status updates: for i in range(0, limit):

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 kno开发者_运维技巧w how?


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消