Browse Source

Shorten content field for very long Reddit search results

Kirill Isakov 9 years ago
parent
commit
a8832574fa
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      searx/engines/reddit.py

+ 4
- 1
searx/engines/reddit.py View File

@@ -66,7 +66,10 @@ def response(resp):
66 66
             img_results.append(params)
67 67
         else:
68 68
             created = datetime.fromtimestamp(data['created_utc'])
69
-            params['content'] = escape(data['selftext'])
69
+            content = escape(data['selftext'])
70
+            if len(content) > 500:
71
+                content = content[:500] + '...'
72
+            params['content'] = content
70 73
             params['publishedDate'] = created
71 74
             text_results.append(params)
72 75