Skip to content

Commit

Permalink
Twitter: lengthen_urls can lengthen media now
Browse files Browse the repository at this point in the history
Updates lengthen_urls in both Twitter and TwitterSnarfer to replace
media links, which were handled separately from other links.
  • Loading branch information
mistydemeo committed Jul 13, 2012
1 parent 5f02ded commit 7655395
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/Twitter/plugin.py
Expand Up @@ -155,6 +155,8 @@ def recode(text):
def lengthen_urls(tweet):
for link in tweet['entities']['urls']:
tweet['text'] = tweet['text'].replace(link['url'], link['expanded_url'])
for media in tweet['entities']["media"]:
tweet['text'] = tweet['text'].replace(media['url'], media['media_url'])

resp = 'Gettin nothin from teh twitter.'
if tweet_id:
Expand Down
2 changes: 2 additions & 0 deletions plugins/TwitterSnarfer/plugin.py
Expand Up @@ -68,6 +68,8 @@ def recode(text):
def lengthen_urls(tweet):
for link in tweet['entities']['urls']:
tweet['text'] = tweet['text'].replace(link['url'], link['expanded_url'])
for media in tweet['entities']["media"]:
tweet['text'] = tweet['text'].replace(media['url'], media['media_url'])

resp = 'Gettin nothin from teh twitter.'
url = 'http://api.twitter.com/1/statuses/show/%s.json?include_entities=true' % (tweet_id)
Expand Down

0 comments on commit 7655395

Please sign in to comment.