From dda74fc9c96d9bf9bcb0b5dac90219e3b31f8390 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Fri, 20 Oct 2023 11:26:28 +0200 Subject: [feat] engine: implementation of mdn --- searx/engines/json_engine.py | 5 +++-- searx/settings.yml | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/searx/engines/json_engine.py b/searx/engines/json_engine.py index 2dd3bc55..9bf5f5c2 100644 --- a/searx/engines/json_engine.py +++ b/searx/engines/json_engine.py @@ -8,6 +8,7 @@ from searx.utils import to_string, html_to_text search_url = None url_query = None +url_prefix = "" content_query = None title_query = None content_html_to_text = False @@ -129,7 +130,7 @@ def response(resp): content = "" results.append( { - 'url': to_string(url), + 'url': url_prefix + to_string(url), 'title': title_filter(to_string(title)), 'content': content_filter(to_string(content)), } @@ -138,7 +139,7 @@ def response(resp): for url, title, content in zip(query(json, url_query), query(json, title_query), query(json, content_query)): results.append( { - 'url': to_string(url), + 'url': url_prefix + to_string(url), 'title': title_filter(to_string(title)), 'content': content_filter(to_string(content)), } diff --git a/searx/settings.yml b/searx/settings.yml index 46c7ec98..4b0c0547 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -1076,6 +1076,25 @@ engines: # shortcut: mtrx # disabled: true + - name: mdn + shortcut: mdn + engine: json_engine + categories: [it] + paging: true + search_url: https://developer.mozilla.org/api/v1/search?q={query}&page={pageno} + results_query: documents + url_query: mdn_url + url_prefix: https://developer.mozilla.org + title_query: title + content_query: summary + about: + website: https://developer.mozilla.org + wikidata_id: Q3273508 + official_api_documentation: null + use_official_api: false + require_api_key: false + results: JSON + - name: metacpan engine: metacpan shortcut: cpan -- cgit v1.2.3