mirror of https://github.com/searxng/searxng.git
Sanitize extract_text
This commit is contained in:
parent
516ea9b769
commit
44c9216c49
|
@ -28,13 +28,13 @@ def extract_text(xpath_results):
|
||||||
result = ''
|
result = ''
|
||||||
for e in xpath_results:
|
for e in xpath_results:
|
||||||
result = result + extract_text(e)
|
result = result + extract_text(e)
|
||||||
return result
|
return result.strip()
|
||||||
elif type(xpath_results) in [_ElementStringResult, _ElementUnicodeResult]:
|
elif type(xpath_results) in [_ElementStringResult, _ElementUnicodeResult]:
|
||||||
# it's a string
|
# it's a string
|
||||||
return ''.join(xpath_results)
|
return ''.join(xpath_results)
|
||||||
else:
|
else:
|
||||||
# it's a element
|
# it's a element
|
||||||
return html_to_text(xpath_results.text_content())
|
return html_to_text(xpath_results.text_content()).strip()
|
||||||
|
|
||||||
|
|
||||||
def extract_url(xpath_results, search_url):
|
def extract_url(xpath_results, search_url):
|
||||||
|
|
Loading…
Reference in New Issue