Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

Replace every bunch of whitespaces with only one space in HTML text

Cqoicebordel52a57ee045e0
diff --git a/searx/utils.py b/searx/utils.py
index 59d4b85be..ef221ef8e 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -119,6 +119,8 @@ class HTMLTextExtractor(HTMLParser):
def html_to_text(html):
+ html = html.replace('\n', ' ')
+ html = ' '.join(html.split())
s = HTMLTextExtractor()
s.feed(html)
return s.get_text()