Selaa lähdekoodia

Sanitize extract_text

Cqoicebordel 10 vuotta sitten
vanhempi
commit
44c9216c49
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2
    2
      searx/engines/xpath.py

+ 2
- 2
searx/engines/xpath.py Näytä tiedosto

@@ -28,13 +28,13 @@ def extract_text(xpath_results):
28 28
         result = ''
29 29
         for e in xpath_results:
30 30
             result = result + extract_text(e)
31
-        return result
31
+        return result.strip()
32 32
     elif type(xpath_results) in [_ElementStringResult, _ElementUnicodeResult]:
33 33
         # it's a string
34 34
         return ''.join(xpath_results)
35 35
     else:
36 36
         # it's a element
37
-        return html_to_text(xpath_results.text_content())
37
+        return html_to_text(xpath_results.text_content()).strip()
38 38
 
39 39
 
40 40
 def extract_url(xpath_results, search_url):