mirror of https://github.com/searxng/searxng.git
[enh] paging support for ddg
This commit is contained in:
parent
805e6f1884
commit
c0afc4fea7
|
@ -3,14 +3,17 @@ from urllib import urlencode
|
||||||
from searx.utils import html_to_text
|
from searx.utils import html_to_text
|
||||||
|
|
||||||
url = 'https://duckduckgo.com/'
|
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'
|
locale = 'us-en'
|
||||||
|
|
||||||
|
paging = True
|
||||||
|
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
|
offset = (params['pageno'] - 1) * 30
|
||||||
q = urlencode({'q': query,
|
q = urlencode({'q': query,
|
||||||
'l': locale})
|
'l': locale})
|
||||||
params['url'] = search_url.format(query=q)
|
params['url'] = search_url.format(query=q, offset=offset)
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue