Browse Source

[fix] digg cookie characters created in module import

misnyo 7 years ago
parent
commit
6e92fb383a
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      searx/engines/digg.py

+ 4
- 3
searx/engines/digg.py View File

32
 content_xpath = './/p//text()'
32
 content_xpath = './/p//text()'
33
 pubdate_xpath = './/time'
33
 pubdate_xpath = './/time'
34
 
34
 
35
+digg_cookie_chars = string.ascii_uppercase + string.ascii_lowercase +\
36
+    string.digits + "+_"
37
+
35
 
38
 
36
 # do search-request
39
 # do search-request
37
 def request(query, params):
40
 def request(query, params):
39
     params['url'] = search_url.format(position=offset,
42
     params['url'] = search_url.format(position=offset,
40
                                       query=quote_plus(query))
43
                                       query=quote_plus(query))
41
     params['cookies']['frontend.auid'] = ''.join(random.choice(
44
     params['cookies']['frontend.auid'] = ''.join(random.choice(
42
-        string.ascii_uppercase +
43
-        string.ascii_lowercase +
44
-        string.digits + "+_") for _ in range(22))
45
+        digg_cookie_chars) for _ in range(22))
45
     return params
46
     return params
46
 
47
 
47
 
48