forked from zaclys/searxng
Merge pull request #21 from dnet/master
Simplified MediaWiki response processing
This commit is contained in:
commit
467ab3791f
|
@ -13,11 +13,6 @@ def request(query, params):
|
||||||
|
|
||||||
def response(resp):
|
def response(resp):
|
||||||
search_results = loads(resp.text)
|
search_results = loads(resp.text)
|
||||||
results = []
|
|
||||||
res = search_results.get('query', {}).get('search', [])
|
res = search_results.get('query', {}).get('search', [])
|
||||||
if not len(res):
|
return [{'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')),
|
||||||
return results
|
'title': result['title']} for result in res[:int(number_of_results)]]
|
||||||
for result in res[:int(number_of_results)]:
|
|
||||||
results.append({'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')), 'title': result['title']})
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue