SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
[feat] json engine: add option to not send page num on first page
Bnyro0f35ef7cd62a
diff --git a/searx/engines/json_engine.py b/searx/engines/json_engine.pyindex 7081bf941..1a2dcda60 100644--- a/searx/engines/json_engine.py+++ b/searx/engines/json_engine.py@@ -20,6 +20,7 @@ Paging:- :py:obj:`paging`- :py:obj:`page_size`- :py:obj:`first_page_num`+- :py:obj:`send_page_num_on_first_page`Time Range:@@ -169,6 +170,10 @@ number, but an offset.'''first_page_num = 1'''Number of the first page (usually 0 or 1).'''+send_page_num_on_first_page = True+'''Whether to include the page number in the request for the first page.+This can help if an engine blocks request that send a page number for the first page.'''+results_query = '''''JSON query for the list of result items.@@ -322,10 +327,13 @@ def request(query, params): # pylint: disable=redefined-outer-nameif params['safesearch']:safe_search = safe_search_map[params['safesearch']]+ pageno = ""+ if send_page_num_on_first_page or params["pageno"] != 1:+ pageno = (params['pageno'] - 1) * page_size + first_page_numfp = { # pylint: disable=invalid-name'query': urlencode({'q': query})[2:],'lang': lang,- 'pageno': (params['pageno'] - 1) * page_size + first_page_num,+ 'pageno': pageno,'time_range': time_range,'safe_search': safe_search,}