on master help sign in
[fix] wikipedia autocomplete error handling
d2f89f0Adam Tauber
searx/autocomplete.py+3−1
@@ -42,7 +42,9 @@ def wikipedia(query):
42 url = 'https://en.wikipedia.org/w/api.php?action=opensearch&{0}&limit=10&namespace=0&format=json' # noqa
42 url = 'https://en.wikipedia.org/w/api.php?action=opensearch&{0}&limit=10&namespace=0&format=json' # noqa
43
43
44 resp = loads(get(url.format(urlencode(dict(q=query)))).text)
44 resp = loads(get(url.format(urlencode(dict(q=query)))).text)
45+ if len(resp) > 1:
45− return resp[1]
46+ return resp[1]
47+ return []
46
48
47
49
48backends = {'dbpedia': dbpedia,
50backends = {'dbpedia': dbpedia,