mirror of
https://github.com/searxng/searxng.git
synced 2025-07-15 01:09:21 +02:00
[feat] new engine: wikispecies
This commit is contained in:
parent
5a5b95df3e
commit
7d8c20c80d
2 changed files with 16 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue