From 8849606e5f75e6769399aadf06106aee44d0278f Mon Sep 17 00:00:00 2001 From: misnyo Date: Thu, 31 Aug 2017 16:11:04 +0200 Subject: [PATCH 1/2] [fix] gigablast api fix --- searx/engines/gigablast.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/searx/engines/gigablast.py b/searx/engines/gigablast.py index 37933c69b..6681de996 100644 --- a/searx/engines/gigablast.py +++ b/searx/engines/gigablast.py @@ -10,6 +10,7 @@ @parse url, title, content """ +import random from json import loads from time import time from lxml.html import fromstring @@ -32,7 +33,8 @@ search_string = 'search?{query}'\ '&qh=0'\ '&qlang={lang}'\ '&ff={safesearch}'\ - '&rxikd={rxikd}' # random number - 9 digits + '&rxieu={rxieu}'\ + '&rand={rxikd}' # current unix timestamp # specific xpath variables results_xpath = '//response//result' @@ -59,10 +61,12 @@ def request(query, params): else: safesearch = 0 + # rxieu is some kind of hash from the search query, but accepts random atm search_path = search_string.format(query=urlencode({'q': query}), offset=offset, number_of_results=number_of_results, - rxikd=str(time())[:9], + rxikd=int(time() * 1000), + rxieu=random.randint(1000000000,9999999999), lang=language, safesearch=safesearch) From b91772eff155f79fdf01be5695f3f15ea24ad17e Mon Sep 17 00:00:00 2001 From: misnyo Date: Thu, 31 Aug 2017 21:49:19 +0200 Subject: [PATCH 2/2] [fix] gigablast pep8 fix --- searx/engines/gigablast.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searx/engines/gigablast.py b/searx/engines/gigablast.py index 6681de996..2bdc97fd1 100644 --- a/searx/engines/gigablast.py +++ b/searx/engines/gigablast.py @@ -66,7 +66,7 @@ def request(query, params): offset=offset, number_of_results=number_of_results, rxikd=int(time() * 1000), - rxieu=random.randint(1000000000,9999999999), + rxieu=random.randint(1000000000, 9999999999), lang=language, safesearch=safesearch)