Skip to content

Commit

Permalink
[mod] add option max_page to bing, brave, qwant, startpage & mojeek
Browse files Browse the repository at this point in the history
[1] searxng#2982 (comment)

Reported-by: @Damaj301damaj-lol [1]
Signed-off-by: Markus Heiser <[email protected]>
  • Loading branch information
return42 committed Dec 3, 2023
1 parent 2274d55 commit 3829c25
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions searx/engines/bing.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
# engine dependent config
categories = ['general', 'web']
paging = True
max_page = 200
"""200 pages maximum (``&first=1991``)"""

time_range_support = True
safesearch = True
"""Bing results are always SFW. To get NSFW links from bing some age
Expand Down
4 changes: 4 additions & 0 deletions searx/engines/brave.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@
paging = False
"""Brave only supports paging in :py:obj:`brave_category` ``search`` (UI
category All)."""
max_page = 10
"""Tested 9 pages maximum (``&offset=8``), to be save max is set to 10. Trying
to do more won't return any result and you will most likely be flagged as a bot.
"""

safesearch = True
safesearch_map = {2: 'strict', 1: 'moderate', 0: 'off'} # cookie: safesearch=off
Expand Down
8 changes: 4 additions & 4 deletions searx/engines/qwant.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
# engine dependent config
categories = []
paging = True
max_page = 5
"""5 pages maximum (``&p=5``): Trying to do more just results in an improper
redirect"""

qwant_categ = None
"""One of ``web-lite`` (or ``web``), ``news``, ``images`` or ``videos``"""

Expand Down Expand Up @@ -112,10 +116,6 @@ def request(query, params):
args = {'q': query}
params['raise_for_httperror'] = False

# all qwant engines (incl qwant-lite) delivers only 5 pages maximum
if params['pageno'] > 5:
return None

if qwant_categ == 'web-lite':

url = web_lite_url + '?'
Expand Down
3 changes: 3 additions & 0 deletions searx/engines/startpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@
# engine dependent config
categories = ['general', 'web']
paging = True
max_page = 18
"""Tested 18 pages maximum (argument ``page``), to be save max is set to 20."""

time_range_support = True
safesearch = True

Expand Down
1 change: 1 addition & 0 deletions searx/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1871,6 +1871,7 @@ engines:
suggestion_xpath: //div[@class="top-info"]/p[@class="top-info spell"]/em/a
first_page_num: 0
page_size: 10
max_page: 100
disabled: true
about:
website: https://www.mojeek.com/
Expand Down

0 comments on commit 3829c25

Please sign in to comment.