Permalink
Browse files

twiffer.py: Expand URLs

  • Loading branch information...
srynot4sale committed Feb 16, 2013
1 parent 4f3cf03 commit d3764dc3b55ca78dbb8df537c4a54973c97c555e
Showing with 5 additions and 0 deletions.
  1. +5 −0 twiffer.py
View
@@ -213,6 +213,11 @@ def format_tweet(tweet, retweet, seen, ratings, count, total):
time_created = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(get_utc_timestamp(tweet['created_at'])))
+ # Expand links in tweet
+ if 'entities' in tweet.keys() and 'urls' in tweet['entities'].keys():
+ for url in tweet['entities']['urls']:
+ text = text.replace(url['url'], url['expanded_url'])
+
BLUE = '\033[94m'
GREEN = '\033[92m'
RED = '\033[91m'

0 comments on commit d3764dc

Please sign in to comment.