Merge branch 'unit-tests' of https://github.com/Cqoicebordel/searx into Cqoicebordel-unit-tests

Conflicts:
	searx/tests/test_engines.py
This commit is contained in:
Adam Tauber 2015-02-02 09:36:43 +01:00
commit 7f865356f9
45 changed files with 3692 additions and 71 deletions

View file

@ -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()