Browse Source

Merge pull request #1019 from misnyo/gigablast

[fix] gigablast api fix
Adam Tauber 7 years ago
parent
commit
c505c3c1ca
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      searx/engines/gigablast.py

+ 6
- 2
searx/engines/gigablast.py View File

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