Explorar el Código

[fix] digg now requires cookie for search

misnyo hace 7 años
padre
commit
a49cc18f9c
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6
    0
      searx/engines/digg.py

+ 6
- 0
searx/engines/digg.py Ver fichero

@@ -10,6 +10,8 @@
10 10
  @parse       url, title, content, publishedDate, thumbnail
11 11
 """
12 12
 
13
+import random
14
+import string
13 15
 from dateutil import parser
14 16
 from json import loads
15 17
 from lxml import html
@@ -36,6 +38,10 @@ def request(query, params):
36 38
     offset = (params['pageno'] - 1) * 10
37 39
     params['url'] = search_url.format(position=offset,
38 40
                                       query=quote_plus(query))
41
+    params['cookies']['frontend.auid'] = ''.join(random.choice(
42
+        string.ascii_uppercase +
43
+        string.ascii_lowercase +
44
+        string.digits + "+_") for _ in range(22))
39 45
     return params
40 46
 
41 47