1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-19 19:00:10 +01:00

[enh] simplified mediawiki response processing

This commit is contained in:
András Veres-Szentkirályi 2014-01-14 10:34:35 +01:00
parent 47a23898b3
commit 8dfc272191

View File

@ -13,11 +13,6 @@ def request(query, params):
def response(resp):
search_results = loads(resp.text)
results = []
res = search_results.get('query', {}).get('search', [])
if not len(res):
return 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
return [{'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')),
'title': result['title']} for result in res[:int(number_of_results)]]