From 3c847e4f068b079ca5727ce8f34b7937db1465d7 Mon Sep 17 00:00:00 2001 From: jeancf Date: Mon, 22 Aug 2022 08:54:17 +0200 Subject: [PATCH] Fixed false positive on search for "replying-to" --- twoot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/twoot.py b/twoot.py index 652bbb1..44e7306 100755 --- a/twoot.py +++ b/twoot.py @@ -414,7 +414,9 @@ def main(argv): photos = [] # Add prefix if the tweet is a reply-to - replying_to_class = status.find('div', class_='replying-to') + # Only consider item of class 'replying-to' that is a direct child + # of class 'tweet-body' in status. Others can be in a quoted tweet. + replying_to_class = status.select("div.tweet-body > div.replying-to") if replying_to_class is not None: tweet_text += 'Replying to ' + replying_to_class.a.get_text() + '\n\n'