diff options
author | Adam Tauber <asciimoo@gmail.com> | 2017-01-02 12:36:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-02 12:36:50 +0100 |
commit | 525e5d275c195d26cb9302ceb03f46ffffa6e730 (patch) | |
tree | b405eb055b371ce3b1341d0c5b0d2e3c9ba56099 /searx/engines | |
parent | 3d8c9bab9618b4d0cceadfac888af4560f7d3c9b (diff) | |
parent | 90e1db3e5c628ae73800d51b53032064aadbfb44 (diff) | |
download | searxng-525e5d275c195d26cb9302ceb03f46ffffa6e730.tar.gz searxng-525e5d275c195d26cb9302ceb03f46ffffa6e730.zip |
Merge pull request #801 from dalf/extract_text
[fix] extract_text: use html.tostring instead html_to_text.
Diffstat (limited to 'searx/engines')
-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): |