[fix] engine - qwant delivers only 5 pages maximum

all qwant engines (incl qwant-lite) delivers only 5 pages maximum

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2023-09-18 00:15:57 +02:00 committed by MatthieuBarbu
parent 743515e68a
commit ad518f41f6
1 changed files with 6 additions and 12 deletions

View File

@ -112,12 +112,12 @@ def request(query, params):
args = {'q': query} args = {'q': query}
params['raise_for_httperror'] = False params['raise_for_httperror'] = False
if qwant_categ == 'web-lite': # all qwant engines (incl qwant-lite) delivers only 5 pages maximum
# qwant-lite delivers only 5 pages maximum
if params['pageno'] > 5: if params['pageno'] > 5:
return None return None
if qwant_categ == 'web-lite':
url = web_lite_url + '?' url = web_lite_url + '?'
args['locale'] = q_locale.lower() args['locale'] = q_locale.lower()
args['l'] = q_locale.split('_')[0] args['l'] = q_locale.split('_')[0]
@ -130,21 +130,15 @@ def request(query, params):
args['locale'] = q_locale args['locale'] = q_locale
args['safesearch'] = params['safesearch'] args['safesearch'] = params['safesearch']
args['count'] = 50 args['count'] = 50
offset = (params['pageno'] - 1) * args['count'] args['offset'] = (params['pageno'] - 1) * args['count']
# count + offset must be lower than 250
args['offset'] = min(offset, 199)
else: # web, news, videos else: # web, news, videos
args['locale'] = q_locale args['locale'] = q_locale
args['safesearch'] = params['safesearch'] args['safesearch'] = params['safesearch']
args['count'] = 10 args['count'] = 10
offset = (params['pageno'] - 1) * args['count'] args['offset'] = (params['pageno'] - 1) * args['count']
# count + offset must be lower than 50
args['offset'] = min(offset, 39)
params['url'] = url + urlencode(args) params['url'] = url + urlencode(args)