瀏覽代碼

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

Cqoicebordel 10 年之前
父節點
當前提交
52a57ee045
共有 1 個檔案被更改,包括 2 行新增0 行删除
  1. 2
    0
      searx/utils.py

+ 2
- 0
searx/utils.py 查看文件

@@ -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()