From 5b1b26160a7ec83442ad7ce0fd1e0f2d40f11ae7 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 15 Jul 2019 14:27:37 +0100 Subject: [PATCH] use "extended" tweet mode so long tweets are not truncated --- modules/tweets/__init__.py | 3 ++- modules/tweets/format.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/tweets/__init__.py b/modules/tweets/__init__.py index 979b55b0..9aaaab17 100644 --- a/modules/tweets/__init__.py +++ b/modules/tweets/__init__.py @@ -76,7 +76,8 @@ class Module(ModuleManager.BaseModule): return tweepy.API(auth) def _from_id(self, tweet_id): - return self._get_api(self._get_auth()).get_status(tweet_id) + return self._get_api(self._get_auth()).get_status(tweet_id, + tweet_mode="extended") def _from_username(self, username): return self._get_api(self._get_auth()).user_timeline( screen_name=username, count=1)[0] diff --git a/modules/tweets/format.py b/modules/tweets/format.py index 090ec6cd..af6dfbbb 100644 --- a/modules/tweets/format.py +++ b/modules/tweets/format.py @@ -24,12 +24,12 @@ def _tweet(exports, server, tweet): # having to use hasattr here is nasty. if hasattr(tweet, "retweeted_status"): original_username = tweet.retweeted_status.user.screen_name - original_text = tweet.retweeted_status.text + original_text = tweet.retweeted_status.full_text original_timestamp = _timestamp(tweet.retweeted_status.created_at) return "(@%s%s (%s) retweeted @%s (%s)) %s%s" % (username, verified, created_at, original_username, original_timestamp, html.unescape(original_text), short_url) else: return "(@%s%s, %s) %s%s" % (username, verified, created_at, - html.unescape(tweet.text), short_url) + html.unescape(tweet.full_text), short_url)