on master help sign in
[fix] extract_text: use html.tostring instead html_to_text. Fix #711
commit90e1db3e5c628ae73800d51b53032064aadbfb44 authorAlexandre Flament <alex@al-f.net> dateSat 31 Dec 2016, 13:56 (10 years ago) parenteaa0fb8
1 file changed+3−1
searx/engines/xpath.py+3−1
searx/engines/xpath.py+3−1
@@ -42,7 +42,9 @@ def extract_text(xpath_results):
4242 return ''.join(xpath_results)
4343 else:
4444 # it's a element
45− return html_to_text(xpath_results.text_content()).strip()
45+ text = html.tostring(xpath_results, encoding='unicode', method='text', with_tail=False)
46+ text = text.strip().replace('\n', ' ')
47+ return ' '.join(text.split())
4648
4749
4850def extract_url(xpath_results, search_url):