From 747290e16aedad844c65572413690d6a5ed867b3 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Fri, 22 Jan 2021 09:15:47 -0600 Subject: [PATCH] Require extended tweets for quoted tweets. Fixes #352 --- doc/changelog.md | 3 ++- src/controller/buffers/twitterBuffers.py | 2 +- src/controller/messages.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/changelog.md b/doc/changelog.md index 60d13ac7..992104eb 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -2,7 +2,7 @@ ## changes in this version -* Fixed error when displaying an URL at the end of a line, when the tweet or direct message contained multiple lines. Now the URL should be displayed correctly. ([#305,](https://github.com/manuelcortez/TWBlue/issues/305)) +* Fixed error when displaying an URL at the end of a line, when the tweet or direct message contained multiple lines. Now the URL should be displayed correctly. ([#305,](https://github.com/manuelcortez/TWBlue/issues/305) [#272,](https://github.com/manuelcortez/TWBlue/issues/272)) * TWBlue has been migrated completely to Python 3 (currently, the software builds with Python 3.8). * TWBlue should be restarted gracefully. Before, the application was alerting users of not being closed properly every time the application restarted by itself. * If TWBlue attemps to load an account with invalid tokens (this happens when reactivating a previously deactivated account, or when access to the ap is revoqued), TWBlue will inform the user about this error and will skip the account. Before, the app was unable to start due to a critical error. ([#328,](https://github.com/manuelcortez/TWBlue/issues/328)) @@ -11,6 +11,7 @@ * TWBlue now uses [Tweepy,](https://github.com/tweepy/tweepy) to connect with Twitter. We have adopted this change in order to support Twitter'S API V 2 in the very near future. ([#333,](https://github.com/manuelcortez/TWBlue/issues/337) [#347](https://github.com/manuelcortez/TWBlue/pull/347)) * TWBlue can upload images in Tweets and replies again. ([#240,](https://github.com/manuelcortez/TWBlue/issues/240)) * Fixed the way we use to count characters in Twitter. The new methods in TWBlue take into account special characters and URLS as documented in Twitter. ([#199,](https://github.com/manuelcortez/TWBlue/issues/199) [#315](https://github.com/manuelcortez/TWBlue/issues/315)) +* And more. ([#352,](https://github.com/manuelcortez/TWBlue/issues/352)) ## Changes in version 0.95 diff --git a/src/controller/buffers/twitterBuffers.py b/src/controller/buffers/twitterBuffers.py index 659bedb5..bef1836c 100644 --- a/src/controller/buffers/twitterBuffers.py +++ b/src/controller/buffers/twitterBuffers.py @@ -145,7 +145,7 @@ class baseBufferController(baseBuffers.buffer): while l != False: tweetsList.append(tweet) try: - tweet = self.session.twitter.get_status(id=l, include_ext_alt_text=True) + tweet = self.session.twitter.get_status(id=l, include_ext_alt_text=True, tweet_mode="extended") tweet.full_text = utils.expand_urls(tweet.full_text, tweet.entities) except TweepError as e: utils.twitter_error(e) diff --git a/src/controller/messages.py b/src/controller/messages.py index eeb8b7c0..880ec4a2 100644 --- a/src/controller/messages.py +++ b/src/controller/messages.py @@ -225,7 +225,7 @@ class viewTweet(basicTweet): else: text = text + " @%s: %s\n" % (tweetList[i].user.screen_name, getattr(tweetList[i], value)) # tweets with extended_entities could include image descriptions. - if getattr(tweetList[i], "extended_entities") and "media" in tweetList[i].extended_entities: + if hasattr(tweetList[i], "extended_entities") and "media" in tweetList[i].extended_entities: for z in tweetList[i].extended_entities["media"]: if "ext_alt_text" in z and z["ext_alt_text"] != None: image_description.append(z["ext_alt_text"])