From efc5b481f8ae075749b3a0dc7b6b05f9130073d9 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Tue, 5 Dec 2017 08:43:26 -0600 Subject: [PATCH] Fixed an error when getting some quoted tweets --- src/sessionmanager/session.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sessionmanager/session.py b/src/sessionmanager/session.py index 13568dab..ac0fa737 100644 --- a/src/sessionmanager/session.py +++ b/src/sessionmanager/session.py @@ -482,9 +482,13 @@ class Session(object): else: return quoted_tweet original_tweet = self.check_long_tweet(original_tweet) - urls = utils.find_urls_in_text(original_tweet["full_text"]) + if original_tweet.has_key("full_text"): + value = "full_text" + else: + value = "text" + urls = utils.find_urls_in_text(original_tweet[value]) for url in range(0, len(urls)): - try: original_tweet["full_text"] = original_tweet["full_text"].replace(urls[url], original_tweet["entities"]["urls"][url]["expanded_url"]) + try: original_tweet[value] = original_tweet[value].replace(urls[url], original_tweet["entities"]["urls"][url]["expanded_url"]) except IndexError: pass return compose.compose_quoted_tweet(quoted_tweet, original_tweet)