summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2023-08-03 19:07:22 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2023-08-04 19:06:50 +0200
commit7d8c20c80d86ac47eac86f11533fee038cd48190 (patch)
tree977182c569e8b59445a5468a4a1bb06f5dd525e9
parent5a5b95df3e939b1d5ad4c0179ed960f7de5328b0 (diff)
downloadsearxng-7d8c20c80d86ac47eac86f11533fee038cd48190.tar.gz
searxng-7d8c20c80d86ac47eac86f11533fee038cd48190.zip
[feat] new engine: wikispecies
-rw-r--r--searx/engines/mediawiki.py7
-rw-r--r--searx/settings.yml12
2 files changed, 16 insertions, 3 deletions
diff --git a/searx/engines/mediawiki.py b/searx/engines/mediawiki.py
index 9002e9ba7..27ce36e87 100644
--- a/searx/engines/mediawiki.py
+++ b/searx/engines/mediawiki.py
@@ -3,10 +3,11 @@
General mediawiki-engine (Web)
"""
-from json import loads
from string import Formatter
from urllib.parse import urlencode, quote
+from searx.utils import html_to_text
+
# about
about = {
"website": None,
@@ -69,7 +70,7 @@ def request(query, params):
def response(resp):
results = []
- search_results = loads(resp.text)
+ search_results = resp.json()
# return empty array if there are no results
if not search_results.get('query', {}).get('search'):
@@ -86,7 +87,7 @@ def response(resp):
)
# append result
- results.append({'url': url, 'title': result['title'], 'content': ''})
+ results.append({'url': url, 'title': result['title'], 'content': html_to_text(result.get('snippet', ''))})
# return results
return results
diff --git a/searx/settings.yml b/searx/settings.yml
index 209b32b4d..e498a9ea2 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -1579,6 +1579,18 @@ engines:
website: https://www.wikisource.org/
wikidata_id: Q263
+ - name: wikipecies
+ engine: mediawiki
+ shortcut: wsp
+ categories: [general, science]
+ base_url: "https://species.wikimedia.org/"
+ number_of_results: 5
+ search_type: text
+ disabled: true
+ about:
+ website: https://species.wikimedia.org/
+ wikidata_id: Q13679
+
- name: wiktionary
engine: mediawiki
shortcut: wt