Browse Source

[fix] whitespace duplication fix in nonhtml outputs

asciimoo 11 years ago
parent
commit
5695ec58df
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      searx/webapp.py

+ 3
- 1
searx/webapp.py View File

190
         else:
190
         else:
191
             if 'content' in result:
191
             if 'content' in result:
192
                 result['content'] = html_to_text(result['content']).strip()
192
                 result['content'] = html_to_text(result['content']).strip()
193
-            result['title'] = html_to_text(result['title']).strip()
193
+            # removing html content and whitespace duplications
194
+            result['title'] = ' '.join(html_to_text(result['title'])\
195
+                                       .strip().split())
194
         if len(result['url']) > 74:
196
         if len(result['url']) > 74:
195
             url_parts = result['url'][:35], result['url'][-35:]
197
             url_parts = result['url'][:35], result['url'][-35:]
196
             result['pretty_url'] = '{0}[...]{1}'.format(*url_parts)
198
             result['pretty_url'] = '{0}[...]{1}'.format(*url_parts)