mirror of
https://github.com/searxng/searxng.git
synced 2024-11-22 12:10:11 +01:00
[feat] engine: implementation of mwmbl
This commit is contained in:
parent
bb9e9ab773
commit
c59ae91b76
41
searx/engines/mwmbl.py
Normal file
41
searx/engines/mwmbl.py
Normal file
@ -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
|
@ -1008,6 +1008,12 @@ engines:
|
|||||||
# collection: 'reviews' # name of the db collection
|
# collection: 'reviews' # name of the db collection
|
||||||
# key: 'name' # key in the collection to search for
|
# 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
|
- name: npm
|
||||||
engine: json_engine
|
engine: json_engine
|
||||||
paging: true
|
paging: true
|
||||||
|
Loading…
Reference in New Issue
Block a user