Merge pull request #114 from pmrowla/twitter_rt

fix #11
This commit is contained in:
Ryan Hitchman 2014-08-13 18:47:19 -07:00
commit 2fd1def5f4
1 changed files with 6 additions and 1 deletions

View File

@ -72,7 +72,12 @@ def twitter(inp, api_key=None):
except IndexError:
return 'error: not that many tweets found'
text = http.unescape(tweet["text"]).replace('\n', ' ')
if 'retweeted_status' in tweet:
rt = tweet["retweeted_status"]
rt_text = http.unescape(rt["text"]).replace('\n', ' ')
text = "RT @%s %s" % (rt["user"]["screen_name"], rt_text)
else:
text = http.unescape(tweet["text"]).replace('\n', ' ')
screen_name = tweet["user"]["screen_name"]
time = tweet["created_at"]