Procházet zdrojové kódy

Shorten content field for very long Reddit search results

Kirill Isakov před 9 roky
rodič
revize
a8832574fa
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 4
    1
      searx/engines/reddit.py

+ 4
- 1
searx/engines/reddit.py Zobrazit soubor

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