1
0
mirror of https://github.com/searx/searx synced 2024-11-29 05:30:10 +01:00

[mod] wikipedia limited to first result

This commit is contained in:
asciimoo 2013-10-16 23:21:04 +02:00
parent d7f383d7ea
commit a0037313ea

View File

@ -9,7 +9,8 @@ def request(query, 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'].replace(' ', '_'), 'title': res['title']})
res = search_results.get('query', {}).get('search', [])
if len(res):
results.append({'url': 'https://en.wikipedia.org/wiki/%s' % res[0]['title'].replace(' ', '_'), 'title': res[0]['title']})
return results