Explorar el Código

Shorten content field for very long Reddit search results

Kirill Isakov hace 9 años
padre
commit
a8832574fa
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4
    1
      searx/engines/reddit.py

+ 4
- 1
searx/engines/reddit.py Ver fichero

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