logo

searx

My custom branche(s) on searx, a meta-search engine git clone https://hacktivis.me/git/searx.git
commit: 84cd09ac34bb06bc9a4a2ad702fb29346823e0c8
parent b3fde19ed59c6e05b1f076ea1f8a7cec21229083
Author: a01200356 <a01200356@itesm.mx>
Date:   Sun, 27 Dec 2015 22:01:54 -0600

Merge branch 'master' into wolframalpha

Diffstat:

MAUTHORS.rst3+++
MCHANGELOG.rst21+++++++++++++++++++++
Msearx/engines/gigablast.py39++++++++++++++++++++++++++++++---------
Msearx/tests/engines/test_gigablast.py1+
Msearx/version.py2+-
5 files changed, 56 insertions(+), 10 deletions(-)

diff --git a/AUTHORS.rst b/AUTHORS.rst @@ -38,3 +38,6 @@ generally made searx better: - Niklas Haas - @underr - Emmanuel Benazera +- @GreenLunar +- Noemi Vanyi +- Kang-min Liu diff --git a/CHANGELOG.rst b/CHANGELOG.rst @@ -1,3 +1,23 @@ +0.8.1 2015.12.22 +================ + +- More efficient result parsing +- Rewritten google engine to prevent app crashes +- Other engine fixes/tweaks + + - Bing news + - Btdigg + - Gigablast + - Google images + - Startpage + + +News +~~~~ + +New documentation page is available: https://asciimoo.github.io/searx + + 0.8.0 2015.09.08 ================ @@ -44,6 +64,7 @@ News @dalf joined the maintainer "team" + 0.7.0 2015.02.03 ================ diff --git a/searx/engines/gigablast.py b/searx/engines/gigablast.py @@ -19,11 +19,21 @@ from time import time # engine dependent config categories = ['general'] paging = True -number_of_results = 5 +number_of_results = 10 +language_support = True +safesearch = True -# search-url, invalid HTTPS certificate +# search-url base_url = 'https://gigablast.com/' -search_string = 'search?{query}&n={number_of_results}&s={offset}&format=xml&qh=0&rxiyd={rxiyd}&rand={rand}' +search_string = 'search?{query}'\ + '&n={number_of_results}'\ + '&s={offset}'\ + '&format=xml'\ + '&qh=0'\ + '&rxiyd={rxiyd}'\ + '&rand={rand}'\ + '&qlang={lang}'\ + '&ff={safesearch}' # specific xpath variables results_xpath = '//response//result' @@ -36,12 +46,23 @@ content_xpath = './/sum' def request(query, params): offset = (params['pageno'] - 1) * number_of_results - search_path = search_string.format( - query=urlencode({'q': query}), - offset=offset, - number_of_results=number_of_results, - rxiyd=randint(10000, 10000000), - rand=int(time())) + if params['language'] == 'all': + language = 'xx' + else: + language = params['language'][0:2] + + if params['safesearch'] >= 1: + safesearch = 1 + else: + safesearch = 0 + + search_path = search_string.format(query=urlencode({'q': query}), + offset=offset, + number_of_results=number_of_results, + rxiyd=randint(10000, 10000000), + rand=int(time()), + lang=language, + safesearch=safesearch) params['url'] = base_url + search_path diff --git a/searx/tests/engines/test_gigablast.py b/searx/tests/engines/test_gigablast.py @@ -10,6 +10,7 @@ class TestGigablastEngine(SearxTestCase): query = 'test_query' dicto = defaultdict(dict) dicto['pageno'] = 0 + dicto['language'] = 'all' params = gigablast.request(query, dicto) self.assertTrue('url' in params) self.assertTrue(query in params['url']) diff --git a/searx/version.py b/searx/version.py @@ -19,7 +19,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. # version of searx VERSION_MAJOR = 0 VERSION_MINOR = 8 -VERSION_BUILD = 0 +VERSION_BUILD = 1 VERSION_STRING = "{0}.{1}.{2}".format(VERSION_MAJOR, VERSION_MINOR,