Kaynağa Gözat

[fix] gigablast url params

Adam Tauber 9 yıl önce
ebeveyn
işleme
f1ac794a07
1 değiştirilmiş dosya ile 6 ekleme ve 2 silme
  1. 6
    2
      searx/engines/gigablast.py

+ 6
- 2
searx/engines/gigablast.py Dosyayı Görüntüle

13
 from urllib import urlencode
13
 from urllib import urlencode
14
 from cgi import escape
14
 from cgi import escape
15
 from lxml import etree
15
 from lxml import etree
16
+from random import randint
17
+from time import time
16
 
18
 
17
 # engine dependent config
19
 # engine dependent config
18
 categories = ['general']
20
 categories = ['general']
21
 
23
 
22
 # search-url, invalid HTTPS certificate
24
 # search-url, invalid HTTPS certificate
23
 base_url = 'http://gigablast.com/'
25
 base_url = 'http://gigablast.com/'
24
-search_string = 'search?{query}&n={number_of_results}&s={offset}&xml=1&qh=0'
26
+search_string = 'search?{query}&n={number_of_results}&s={offset}&xml=1&qh=0&uxid={uxid}&rand={rand}'
25
 
27
 
26
 # specific xpath variables
28
 # specific xpath variables
27
 results_xpath = '//response//result'
29
 results_xpath = '//response//result'
37
     search_path = search_string.format(
39
     search_path = search_string.format(
38
         query=urlencode({'q': query}),
40
         query=urlencode({'q': query}),
39
         offset=offset,
41
         offset=offset,
40
-        number_of_results=number_of_results)
42
+        number_of_results=number_of_results,
43
+        uxid=randint(10000, 10000000),
44
+        rand=int(time()))
41
 
45
 
42
     params['url'] = base_url + search_path
46
     params['url'] = base_url + search_path
43
 
47