From a9faca8ab6e8e916eb2f3302cf356a4b54ac8f58 Mon Sep 17 00:00:00 2001 From: rstefko Date: Wed, 24 Sep 2025 10:57:31 +0200 Subject: [PATCH] refs #1247: Remove DOCTYPE before html parsed --- app/utils/search.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/utils/search.py b/app/utils/search.py index 34b3cb9..71c978a 100644 --- a/app/utils/search.py +++ b/app/utils/search.py @@ -157,8 +157,9 @@ class Search: user_agent=self.user_agent) # Produce cleanable html soup from response - get_body_safed = get_body.text.replace("<","andlt;").replace(">","andgt;") - html_soup = bsoup(get_body_safed, 'html.parser').html + get_body_safed = re.sub(r']*>\s*', '', get_body.text, flags=re.IGNORECASE) + get_body_safed = get_body_safed.replace("<","andlt;").replace(">","andgt;") + html_soup = bsoup(get_body_safed, 'html.parser') # Replace current soup if view_image is active # FIXME: Broken since the user agent changes as of 16 Jan 2025