Fixed a few issues with long tweets

This commit is contained in:
Manuel Cortez 2016-07-18 09:56:22 -05:00
parent c1c001ad96
commit f9d869e824
2 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@
from twitter import utils
def is_long(tweet):
if tweet.has_key("is_quote_status") and tweet["is_quote_status"] == True:
if tweet.has_key("is_quote_status") and tweet["is_quote_status"] == True and tweet.has_key("quoted_status"):
return tweet["quoted_status_id"]
return False

View File

@ -51,7 +51,7 @@ def compose_tweet(tweet, db, relative_times):
user = tweet["user"]["name"]
source = re.sub(r"(?s)<.*?>", "", tweet["source"])
if tweet.has_key("retweeted_status"):
if tweet.has_key("message") == False or tweet["retweeted_status"]["is_quote_status"] == False:
if tweet.has_key("message") == False and tweet["retweeted_status"]["is_quote_status"] == False:
text = "RT @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], StripChars(tweet["retweeted_status"]["text"]))
elif tweet["retweeted_status"]["is_quote_status"]:
text = "%s" % (StripChars(tweet[value]))