Pārlūkot izejas kodu

Replace every bunch of whitespaces with only one space in HTML text

Cqoicebordel 10 gadus atpakaļ
vecāks
revīzija
52a57ee045
1 mainītis faili ar 2 papildinājumiem un 0 dzēšanām
  1. 2
    0
      searx/utils.py

+ 2
- 0
searx/utils.py Parādīt failu

@@ -119,6 +119,8 @@ class HTMLTextExtractor(HTMLParser):
119 119
 
120 120
 
121 121
 def html_to_text(html):
122
+    html = html.replace('\n', ' ')
123
+    html = ' '.join(html.split())
122 124
     s = HTMLTextExtractor()
123 125
     s.feed(html)
124 126
     return s.get_text()