logo

searx

My custom branche(s) on searx, a meta-search engine
commit: e4b768b6ccc6bc553665dddfa23e54bf4e75875e
parent: 1291931cfc8995cfc7a851812ebbb9727b486f7f
Author: asciimoo <asciimoo@gmail.com>
Date:   Tue, 15 Oct 2013 20:51:35 +0200

[enh] wikipedia search added

Diffstat:

Asearx/engines/wikipedia.py15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/searx/engines/wikipedia.py b/searx/engines/wikipedia.py @@ -0,0 +1,15 @@ +from json import loads + +def request(query, params): + params['url'] = 'http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=%s&srprop=timestamp&format=json' % query + + return 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'], 'title': res['title']}) + return results +