From a24f43dbfaf93266d05454347c6aac532ee0b7a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JC=20Fran=C3=A7ois?= Date: Tue, 17 Sep 2019 07:18:55 +0000 Subject: [PATCH] Fixed bug when tweet text is empty --- twoot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twoot.py b/twoot.py index d61aef1..381322f 100755 --- a/twoot.py +++ b/twoot.py @@ -73,7 +73,7 @@ def cleanup_tweet_text(tt_iter): # If it is not a link to some embedded content, keep raw link if not tag.has_attr('data-pre-embedded') and tag.has_attr('data-expanded-url'): # Add a sometimes missing space before url - if tweet_text[len(tweet_text)-1] != ' ' and tweet_text[len(tweet_text)-1] != '\n': + if not tweet_text.endswith(' ') and not tweet_text.endswith('\n'): tweet_text += ' ' # Add full url tweet_text += tag['data-expanded-url']