diff options
author | David A Roberts <d@vidr.cc> | 2016-07-16 19:26:29 +1000 |
---|---|---|
committer | David A Roberts <d@vidr.cc> | 2016-08-10 11:15:30 +1000 |
commit | 117d36b66eae1a36d730135f6a659d515f2514f2 (patch) | |
tree | 7a8fd1965e26799409a9717c37ecf3bd5d02f47f /searx/engines/json_engine.py | |
parent | 53c9185cbeb05026909adec164b859e09850c74e (diff) | |
download | searxng-117d36b66eae1a36d730135f6a659d515f2514f2.tar.gz searxng-117d36b66eae1a36d730135f6a659d515f2514f2.zip |
Add Crossref search engine and DOAI rewrite plugin
Diffstat (limited to 'searx/engines/json_engine.py')
-rw-r--r-- | searx/engines/json_engine.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/searx/engines/json_engine.py b/searx/engines/json_engine.py index 5525b7f7e..cd5e3a7e1 100644 --- a/searx/engines/json_engine.py +++ b/searx/engines/json_engine.py @@ -8,6 +8,14 @@ content_query = None title_query = None # suggestion_xpath = '' +# parameters for engines with paging support +# +# number of results on each page +# (only needed if the site requires not a page number, but an offset) +page_size = 1 +# number of the first page (usually 0 or 1) +first_page_num = 1 + def iterate(iterable): if type(iterable) == dict: @@ -69,8 +77,14 @@ def query(data, query_string): def request(query, params): query = urlencode({'q': query})[2:] - params['url'] = search_url.format(query=query) + + fp = {'query': query} + if paging and search_url.find('{pageno}') >= 0: + fp['pageno'] = (params['pageno'] + first_page_num - 1) * page_size + + params['url'] = search_url.format(**fp) params['query'] = query + return params |