From 3b950929b10068f08a0ccd877d43e7551bfde71f Mon Sep 17 00:00:00 2001 From: marc Date: Sat, 27 May 2017 20:55:23 -0500 Subject: [fix] fix duckduckgo's offset First page now starts with 0 offset, rather than starting on the 30th result. DuckDuckGo returns 30 results on each page. --- searx/engines/duckduckgo.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'searx') diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py index 1c0587451..8b6411ca2 100644 --- a/searx/engines/duckduckgo.py +++ b/searx/engines/duckduckgo.py @@ -79,16 +79,15 @@ def request(query, params): if params['time_range'] and params['time_range'] not in time_range_dict: return params - offset = 30 + (params['pageno'] - 1) * 50 - dc_param = offset + 1 + offset = (params['pageno'] - 1) * 30 region_code = get_region_code(params['language']) if region_code: params['url'] = url.format( - query=urlencode({'q': query, 'kl': region_code}), offset=offset, dc_param=dc_param) + query=urlencode({'q': query, 'kl': region_code}), offset=offset, dc_param=offset) else: params['url'] = url.format( - query=urlencode({'q': query}), offset=offset, dc_param=dc_param) + query=urlencode({'q': query}), offset=offset, dc_param=offset) if params['time_range'] in time_range_dict: params['url'] += time_range_url.format(range=time_range_dict[params['time_range']]) -- cgit v1.2.3