mirror of
https://github.com/searx/searx
synced 2024-11-27 04:12:25 +01:00
[enh] wikipedia search added
This commit is contained in:
parent
1291931cfc
commit
e4b768b6cc
15
searx/engines/wikipedia.py
Normal file
15
searx/engines/wikipedia.py
Normal file
@ -0,0 +1,15 @@
|
||||
from json import loads
|
||||
|
||||
def request(query, params):
|
||||
params['url'] = 'http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=%s&srprop=timestamp&format=json' % query
|
||||
|
||||
return params
|
||||
|
||||
|
||||
def response(resp):
|
||||
search_results = loads(resp.text)
|
||||
results = []
|
||||
for res in search_results.get('query', {}).get('search', []):
|
||||
results.append({'url': 'https://en.wikipedia.org/wiki/%s' % res['title'], 'title': res['title']})
|
||||
return results
|
||||
|
Loading…
Reference in New Issue
Block a user