diff options
| author | Allen <64094914+allendema@users.noreply.github.com> | 2022-06-10 23:26:55 +0200 |
|---|---|---|
| committer | pi_searxng <pi@raspberrypi.local> | 2022-06-11 14:17:44 +0200 |
| commit | fd9a13a3e5a2b2725052a829b0027711d771b891 (patch) | |
| tree | 3324af35746e92a6c647bd62ff055bf88f29c420 | |
| parent | 59ef9b9287f1beda12f7b9a20b93cbc378a22bac (diff) | |
[enh] Initial no paging support for Yep.com
Upstream example query:
https://yep.com/web?q=test
https://yep.com/about
| -rw-r--r-- | searx/engines/json_engine.py | 8 | ||||
| -rw-r--r-- | searx/settings.yml | 24 |
2 files changed, 32 insertions, 0 deletions
diff --git a/searx/engines/json_engine.py b/searx/engines/json_engine.py index f53bc0bf4..2dd3bc55e 100644 --- a/searx/engines/json_engine.py +++ b/searx/engines/json_engine.py @@ -16,6 +16,11 @@ paging = False suggestion_query = '' results_query = '' +cookies = {} +headers = {} +'''Some engines might offer different result based on cookies or headers. +Possible use-case: To set safesearch cookie or header to moderate.''' + # parameters for engines with paging support # # number of results on each page @@ -88,6 +93,9 @@ def request(query, params): if paging and search_url.find('{pageno}') >= 0: fp['pageno'] = (params['pageno'] - 1) * page_size + first_page_num + params['cookies'].update(cookies) + params['headers'].update(headers) + params['url'] = search_url.format(**fp) params['query'] = query diff --git a/searx/settings.yml b/searx/settings.yml index 6a2142b83..34c1bb0b1 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -402,6 +402,30 @@ engines: require_api_key: false results: JSON + - name: yep + engine: json_engine + shortcut: yep + categories: general + disabled: true + paging: false + page_size: 10 + content_html_to_text: true + title_html_to_text: true + search_url: https://api.yep.com/fs/1/?type=web&q={query}&no_correct=false + results_query: 1/results + title_query: title + url_query: url + content_query: snippet + timeout: 12.0 + headers: + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' + 'Sec-Fetch-Dest': 'document' + about: + website: https://yep.com + use_official_api: false + require_api_key: false + results: JSON + - name: currency engine: currency_convert categories: general |