forked from Ponysearch/Ponysearch
[mod] wikipedia limited to first result
This commit is contained in:
parent
d7f383d7ea
commit
a0037313ea
1 changed files with 3 additions and 2 deletions
|
@ -9,7 +9,8 @@ def request(query, params):
|
||||||
def response(resp):
|
def response(resp):
|
||||||
search_results = loads(resp.text)
|
search_results = loads(resp.text)
|
||||||
results = []
|
results = []
|
||||||
for res in search_results.get('query', {}).get('search', []):
|
res = search_results.get('query', {}).get('search', [])
|
||||||
results.append({'url': 'https://en.wikipedia.org/wiki/%s' % res['title'].replace(' ', '_'), 'title': res['title']})
|
if len(res):
|
||||||
|
results.append({'url': 'https://en.wikipedia.org/wiki/%s' % res[0]['title'].replace(' ', '_'), 'title': res[0]['title']})
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue