From 35ecb6ec5d650aebb4acadd5fc5542b3fc7d81dd Mon Sep 17 00:00:00 2001 From: asciimoo Date: Thu, 30 Jan 2014 01:44:12 +0100 Subject: [PATCH] [enh] paging support for mediawiki --- searx/engines/mediawiki.py | 6 ++++-- searx/settings.yml | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/searx/engines/mediawiki.py b/searx/engines/mediawiki.py index bc4aab6df..f8cfb9afa 100644 --- a/searx/engines/mediawiki.py +++ b/searx/engines/mediawiki.py @@ -3,13 +3,15 @@ from urllib import urlencode, quote url = 'https://en.wikipedia.org/' -search_url = url + 'w/api.php?action=query&list=search&{query}&srprop=timestamp&format=json' # noqa +search_url = url + 'w/api.php?action=query&list=search&{query}&srprop=timestamp&format=json&sroffset={offset}' # noqa number_of_results = 10 def request(query, params): - params['url'] = search_url.format(query=urlencode({'srsearch': query})) + offset = (params['pageno'] - 1) * 10 + params['url'] = search_url.format(query=urlencode({'srsearch': query}), + offset=offset) return params diff --git a/searx/settings.yml b/searx/settings.yml index a905d617c..fe005252d 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -10,6 +10,7 @@ engines: engine : mediawiki url : https://en.wikipedia.org/ number_of_results : 1 + paging : False - name : bing engine : bing