diff options
author | Adam Tauber <asciimoo@gmail.com> | 2017-02-02 18:33:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-02 18:33:41 +0100 |
commit | e389a0c7219eedf1ec9287712ae4d20c8546db5e (patch) | |
tree | 454f3f847b46295d29468adc1d07e4d366082b9e | |
parent | 3ecde5bc3a771abf39f3d072cc0424de27d4b784 (diff) | |
parent | 742e4dfdcc9c1c47e76f0f9c5e9feb8a1c59b664 (diff) | |
download | searxng-e389a0c7219eedf1ec9287712ae4d20c8546db5e.tar.gz searxng-e389a0c7219eedf1ec9287712ae4d20c8546db5e.zip |
Merge pull request #849 from kvch/ddg-paging-fix
fix paging of duckduckgo
-rw-r--r-- | searx/engines/duckduckgo.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py index df230222d..1ae484123 100644 --- a/searx/engines/duckduckgo.py +++ b/searx/engines/duckduckgo.py @@ -27,7 +27,7 @@ supported_languages_url = 'https://duckduckgo.com/d2030.js' time_range_support = True # search-url -url = 'https://duckduckgo.com/html?{query}&s={offset}' +url = 'https://duckduckgo.com/html?{query}&s={offset}&api=/d.js&o=json&dc={dc_param}' time_range_url = '&df={range}' time_range_dict = {'day': 'd', @@ -46,7 +46,8 @@ def request(query, params): if params['time_range'] and params['time_range'] not in time_range_dict: return params - offset = (params['pageno'] - 1) * 30 + offset = 30 + (params['pageno'] - 1) * 50 + dc_param = offset + 1 # custom fixes for languages if params['language'] == 'all': @@ -79,10 +80,10 @@ def request(query, params): if locale: params['url'] = url.format( - query=urlencode({'q': query, 'kl': locale}), offset=offset) + query=urlencode({'q': query, 'kl': locale}), offset=offset, dc_param=dc_param) else: params['url'] = url.format( - query=urlencode({'q': query}), offset=offset) + query=urlencode({'q': query}), offset=offset, dc_param=dc_param) if params['time_range'] in time_range_dict: params['url'] += time_range_url.format(range=time_range_dict[params['time_range']]) |