summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--searx/utils.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/searx/utils.py b/searx/utils.py
index 3c60851fa..7b7cd8f5d 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -161,9 +161,11 @@ def html_to_text(html_str: str) -> str:
s = _HTMLTextExtractor()
try:
s.feed(html_str)
+ s.close()
except AssertionError:
s = _HTMLTextExtractor()
s.feed(escape(html_str, quote=True))
+ s.close()
except _HTMLTextExtractorException:
logger.debug("HTMLTextExtractor: invalid HTML\n%s", html_str)
return s.get_text()