Fixed rendering of retweets of quoted tweets. Fixes #365

This commit is contained in:
2021-03-09 16:41:58 -06:00
parent 5b0b26799d
commit 45deae3402
3 changed files with 5 additions and 4 deletions

View File

@@ -25,7 +25,7 @@ def is_long(tweet):
returns True if a quote is detected, False otherwise."""
if hasattr(tweet, "quoted_status_id") and hasattr(tweet, "quoted_status"):
return tweet.quoted_status_id
elif hasattr(tweet, "retweeted_status") and hasattr(tweet, "quoted_status_id") and hasattr(tweet, "quoted_status"):
elif hasattr(tweet, "retweeted_status") and hasattr(tweet.retweeted_status, "quoted_status_id") and hasattr(tweet.retweeted_status, "quoted_status"):
return tweet.retweeted_status.quoted_status_id
return False

View File

@@ -352,16 +352,16 @@ class Session(base.baseSession):
return tweet
def get_quoted_tweet(self, tweet):
""" Process a tweet and extract all information related to the quote."""
""" Process a tweet and extract all information related to the quote. """
quoted_tweet = tweet
if hasattr(tweet, "full_text"):
value = "full_text"
else:
value = "text"
setattr(quoted_tweet, value, utils.expand_urls(getattr(quoted_tweet, value), quoted_tweet.entities))
if hasattr(quoted_tweet, "quoted_status"):
if quoted_tweet.is_quote_status == True and hasattr(quoted_tweet, "quoted_status"):
original_tweet = quoted_tweet.quoted_status
elif hasattr(quoted_tweet, "retweeted_status") and hasattr(quoted_tweet.retweeted_status, "quoted_status"):
elif hasattr(quoted_tweet, "retweeted_status") and quoted_tweet.retweeted_status.is_quote_status == True and hasattr(quoted_tweet.retweeted_status, "quoted_status"):
original_tweet = quoted_tweet.retweeted_status.quoted_status
else:
return quoted_tweet