diff options
author | Bnyro <bnyro@tutanota.com> | 2023-08-15 19:01:47 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2023-08-19 18:23:42 +0200 |
commit | c59ae91b7630e137d883fdf51aaa5fad3eb979cf (patch) | |
tree | 9772e5cc4534530e79cf8a8aba0853fc9c8c2923 /searx | |
parent | bb9e9ab773ddaccbecebbec532063a015d94ceaf (diff) | |
download | searxng-c59ae91b7630e137d883fdf51aaa5fad3eb979cf.tar.gz searxng-c59ae91b7630e137d883fdf51aaa5fad3eb979cf.zip |
[feat] engine: implementation of mwmbl
Diffstat (limited to 'searx')
-rw-r--r-- | searx/engines/mwmbl.py | 41 | ||||
-rw-r--r-- | searx/settings.yml | 6 |
2 files changed, 47 insertions, 0 deletions
diff --git a/searx/engines/mwmbl.py b/searx/engines/mwmbl.py new file mode 100644 index 000000000..501501c20 --- /dev/null +++ b/searx/engines/mwmbl.py @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later +# lint: pylint +"""mwmbl (general) +""" + +from urllib.parse import urlencode + +about = { + "website": 'https://github.com/mwmbl/mwmbl', + "official_api_documentation": None, + "use_official_api": True, + "require_api_key": False, + "results": 'JSON', +} +paging = False +categories = ['general'] + +api_url = "https://api.mwmbl.org" + + +def request(query, params): + params['url'] = f"{api_url}/search?{urlencode({'s': query})}" + return params + + +def response(resp): + results = [] + + json_results = resp.json() + + for result in json_results: + title_parts = [title['value'] for title in result['title']] + results.append( + { + 'url': result['url'], + 'title': ''.join(title_parts), + 'content': result['extract'][0]['value'], + } + ) + + return results diff --git a/searx/settings.yml b/searx/settings.yml index b4431e332..9dc0b75c0 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -1008,6 +1008,12 @@ engines: # collection: 'reviews' # name of the db collection # key: 'name' # key in the collection to search for + - name: mwmbl + engine: mwmbl + # api_url: https://api.mwmbl.org + shortcut: mwm + disabled: true + - name: npm engine: json_engine paging: true |