Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

twiffer.py: Expand URLs

  • Loading branch information...
commit d3764dc3b55ca78dbb8df537c4a54973c97c555e 1 parent 4f3cf03
@srynot4sale authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 twiffer.py
View
5 twiffer.py
@@ -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'
Please sign in to comment.
Something went wrong with that request. Please try again.