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
[mod] yep: fix engine due to new API layout (#6048)
Bnyrod501b0420a29
diff --git a/searx/engines/yep.py b/searx/engines/yep.pyindex 2de18b729..37ee458c4 100644--- a/searx/engines/yep.py+++ b/searx/engines/yep.py@@ -1,10 +1,17 @@# SPDX-License-Identifier: AGPL-3.0-or-later"""Yep (general, images, news)"""-from datetime import datetime+import typing as t+from urllib.parse import urlencode++from searx.result_types import EngineResultsfrom searx.utils import html_to_text+if t.TYPE_CHECKING:+ from searx.extended_types import SXNG_Response+ from searx.search.processors import OnlineParams+about = {'website': 'https://yep.com/','official_api_documentation': 'https://docs.developer.yelp.com',@@ -14,69 +21,32 @@ about = {}base_url = "https://api.yep.com"-search_type = "web" # 'web', 'images', 'news'safesearch = Truesafesearch_map = {0: 'off', 1: 'moderate', 2: 'strict'}enable_http2 = False+results_per_page = 20-def request(query, params):- args = {- 'client': 'web',- 'no_correct': 'false',- 'q': query,- 'safeSearch': safesearch_map[params['safesearch']],- 'type': search_type,- }++def request(query: str, params: 'OnlineParams') -> None:+ args = {'query': query, 'safeSearch': safesearch_map[params['safesearch']], 'limit': results_per_page}params['url'] = f"{base_url}/fs/2/search?{urlencode(args)}"params['headers']['Referer'] = 'https://yep.com/'params['headers']['Origin'] = 'https://yep.com'- return params---def _web_result(result):- return {- 'url': result['url'],- 'title': result['title'],- 'content': html_to_text(result['snippet']),- }-def _images_result(result):- return {- 'template': 'images.html',- 'url': result['host_page'],- 'title': result.get('title', ''),- 'content': '',- 'img_src': result['image_id'],- 'thumbnail_src': result['src'],- }---def _news_result(result):- return {- 'url': result['url'],- 'title': result['title'],- 'content': html_to_text(result['snippet']),- 'publishedDate': datetime.strptime(result['first_seen'][:19], '%Y-%m-%dT%H:%M:%S'),- }---def response(resp):- results = []+def response(resp: 'SXNG_Response') -> EngineResults:+ res = EngineResults()for result in resp.json()[1]['results']:- if search_type == "web":- if result['type'] != 'Organic':- continue- results.append(_web_result(result))- elif search_type == "images":- results.append(_images_result(result))- elif search_type == "news":- results.append(_news_result(result))- else:- raise ValueError(f"Unsupported yep search type: {search_type}")-- return results+ res.add(+ res.types.MainResult(+ url=result['url'],+ title=result['title'],+ content=html_to_text(result['snippet']),+ )+ )++ return resdiff --git a/searx/settings.yml b/searx/settings.ymlindex 3e363cbee..d63a3d4bd 100644--- a/searx/settings.yml+++ b/searx/settings.yml@@ -688,22 +688,6 @@ engines:engine: yepshortcut: yepcategories: general- search_type: web- timeout: 15- disabled: true-- - name: yep images- engine: yep- shortcut: yepi- categories: images- search_type: images- disabled: true-- - name: yep news- engine: yep- shortcut: yepn- categories: news- search_type: newsdisabled: true- name: currency