From 394fbb5f56ebf95206ae69cc5b34cdf39089d38e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 16 May 2021 02:35:55 +0200 Subject: [PATCH] [twitter] strip useless t.co links (#1532) The 'full_text' of Tweets with media content usually ends with a t.co link to itself. This commit removes those. --- gallery_dl/extractor/twitter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/twitter.py b/gallery_dl/extractor/twitter.py index 10f3b394..a9ec6587 100644 --- a/gallery_dl/extractor/twitter.py +++ b/gallery_dl/extractor/twitter.py @@ -191,7 +191,8 @@ class TwitterExtractor(Extractor): if urls: for url in urls: content = content.replace(url["url"], url["expanded_url"]) - tdata["content"] = content + txt, _, tco = content.rpartition(" ") + tdata["content"] = txt if tco.startswith("https://t.co/") else content if "in_reply_to_screen_name" in tweet: tdata["reply_to"] = tweet["in_reply_to_screen_name"]