summaryrefslogtreecommitdiff
path: root/searx/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/utils.py')
-rw-r--r--searx/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/utils.py b/searx/utils.py
index c47d3be17..c0afc94cb 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -115,10 +115,12 @@ class HTMLTextExtractor(HTMLParser):
self.result.append(name)
def get_text(self):
- return u''.join(self.result)
+ return u''.join(self.result).strip()
def html_to_text(html):
+ html = html.replace('\n', ' ')
+ html = ' '.join(html.split())
s = HTMLTextExtractor()
s.feed(html)
return s.get_text()