From 27f61c4374cbb0e76423cc49121c2bd10b4aead1 Mon Sep 17 00:00:00 2001 From: Agatha Rose Date: Thu, 18 Feb 2021 18:01:43 +0200 Subject: [PATCH] Make bs4 only replace the tag name instead of name and contents --- functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions.py b/functions.py index 04534a2..0280cae 100755 --- a/functions.py +++ b/functions.py @@ -68,10 +68,10 @@ def extract_toot(toot): toot = html.unescape(toot) # convert HTML escape codes to text soup = BeautifulSoup(toot, "html.parser") for lb in soup.select("br"): # replace
with linebreak - lb.replace_with("\n") + lb.name = "\n" for p in soup.select("p"): # ditto for

- p.replace_with("\n") + p.name = "\n" for ht in soup.select("a.hashtag"): # convert hashtags from links to text ht.unwrap()