mirror of
https://github.com/searxng/searxng
synced 2024-11-01 15:40:29 +00:00
b0d2cd5ca9
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
53 lines
1.3 KiB
Python
53 lines
1.3 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
# lint: pylint
|
|
"""Mwmbl_ is a non-profit, ad-free, free-libre and free-lunch search engine with
|
|
a focus on useability and speed.
|
|
|
|
.. hint::
|
|
|
|
At the moment it is little more than an idea together with a proof of concept
|
|
implementation of the web front-end and search technology on a small index.
|
|
Mwmbl_ does not support regions, languages, safe-search or time range.
|
|
search.
|
|
|
|
.. _Mwmbl: https://github.com/mwmbl/mwmbl
|
|
|
|
"""
|
|
|
|
from urllib.parse import urlencode
|
|
|
|
about = {
|
|
"website": 'https://github.com/mwmbl/mwmbl',
|
|
"official_api_documentation": 'https://api.mwmbl.org/docs',
|
|
"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
|