summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorasciimoo <asciimoo@gmail.com>2014-01-30 01:03:19 +0100
committerasciimoo <asciimoo@gmail.com>2014-01-30 01:03:19 +0100
commitc0afc4fea7bbe526b531c247ef4bdad3074d14aa (patch)
treeea5ed056cba4e313a65d312f0ca9562fffc9f875
parent805e6f1884a969e4134d3049281e49c005bca551 (diff)
downloadsearxng-c0afc4fea7bbe526b531c247ef4bdad3074d14aa.tar.gz
searxng-c0afc4fea7bbe526b531c247ef4bdad3074d14aa.zip
[enh] paging support for ddg
-rw-r--r--searx/engines/duckduckgo.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py
index 7cae87d95..228a3028f 100644
--- a/searx/engines/duckduckgo.py
+++ b/searx/engines/duckduckgo.py
@@ -3,14 +3,17 @@ from urllib import urlencode
from searx.utils import html_to_text
url = 'https://duckduckgo.com/'
-search_url = url + 'd.js?{query}&p=1&s=0'
+search_url = url + 'd.js?{query}&p=1&s={offset}'
locale = 'us-en'
+paging = True
+
def request(query, params):
+ offset = (params['pageno'] - 1) * 30
q = urlencode({'q': query,
'l': locale})
- params['url'] = search_url.format(query=q)
+ params['url'] = search_url.format(query=q, offset=offset)
return params