summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrás Veres-Szentkirályi <vsza@vsza.hu>2014-01-14 10:34:35 +0100
committerAndrás Veres-Szentkirályi <vsza@vsza.hu>2014-01-14 10:34:35 +0100
commit8dfc2721911f8f2fb70fd4d6f4358ff6c520989b (patch)
treef871d2fc3ba1f05f235056f1266295bb4b3c0413
parent47a23898b35fc65280d399bb9cd43e3633e79079 (diff)
downloadsearxng-8dfc2721911f8f2fb70fd4d6f4358ff6c520989b.tar.gz
searxng-8dfc2721911f8f2fb70fd4d6f4358ff6c520989b.zip
[enh] simplified mediawiki response processing
-rw-r--r--searx/engines/mediawiki.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/searx/engines/mediawiki.py b/searx/engines/mediawiki.py
index ff2d85d52..d4b3fd843 100644
--- a/searx/engines/mediawiki.py
+++ b/searx/engines/mediawiki.py
@@ -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)]]