Ver código fonte

Merge pull request #1019 from misnyo/gigablast

[fix] gigablast api fix
Adam Tauber 7 anos atrás
pai
commit
c505c3c1ca
1 arquivos alterados com 6 adições e 2 exclusões
  1. 6
    2
      searx/engines/gigablast.py

+ 6
- 2
searx/engines/gigablast.py Ver arquivo

@@ -10,6 +10,7 @@
10 10
  @parse       url, title, content
11 11
 """
12 12
 
13
+import random
13 14
 from json import loads
14 15
 from time import time
15 16
 from lxml.html import fromstring
@@ -32,7 +33,8 @@ search_string = 'search?{query}'\
32 33
     '&qh=0'\
33 34
     '&qlang={lang}'\
34 35
     '&ff={safesearch}'\
35
-    '&rxikd={rxikd}'  # random number - 9 digits
36
+    '&rxieu={rxieu}'\
37
+    '&rand={rxikd}'  # current unix timestamp
36 38
 
37 39
 # specific xpath variables
38 40
 results_xpath = '//response//result'
@@ -59,10 +61,12 @@ def request(query, params):
59 61
     else:
60 62
         safesearch = 0
61 63
 
64
+    # rxieu is some kind of hash from the search query, but accepts random atm
62 65
     search_path = search_string.format(query=urlencode({'q': query}),
63 66
                                        offset=offset,
64 67
                                        number_of_results=number_of_results,
65
-                                       rxikd=str(time())[:9],
68
+                                       rxikd=int(time() * 1000),
69
+                                       rxieu=random.randint(1000000000, 9999999999),
66 70
                                        lang=language,
67 71
                                        safesearch=safesearch)
68 72