diff options
| author | Alexandre Flament <alex@al-f.net> | 2016-12-31 13:56:09 +0100 |
|---|---|---|
| committer | Alexandre Flament <alex@al-f.net> | 2016-12-31 13:56:09 +0100 |
| commit | 90e1db3e5c628ae73800d51b53032064aadbfb44 (patch) | |
| tree | 699fe88f37cdb69794840b18366872bc32e0909f /searx/engines/xpath.py | |
| parent | eaa0fb8102825fa4ccdb348429fdbf39837921be (diff) | |
[fix] extract_text: use html.tostring instead html_to_text. Fix #711
Diffstat (limited to 'searx/engines/xpath.py')
| -rw-r--r-- | searx/engines/xpath.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py index e5c0c5bea..18943bba4 100644 --- a/searx/engines/xpath.py +++ b/searx/engines/xpath.py @@ -42,7 +42,9 @@ def extract_text(xpath_results): return ''.join(xpath_results) else: # it's a element - return html_to_text(xpath_results.text_content()).strip() + text = html.tostring(xpath_results, encoding='unicode', method='text', with_tail=False) + text = text.strip().replace('\n', ' ') + return ' '.join(text.split()) def extract_url(xpath_results, search_url): |