mirror of
https://github.com/searxng/searxng.git
synced 2024-11-26 21:01:01 +00:00
[fix] extract_text: use html.tostring instead html_to_text. Fix #711
This commit is contained in:
parent
eaa0fb8102
commit
90e1db3e5c
1 changed files with 3 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue