diff options
author | neodarz <neodarz@neodarz.net> | 2019-01-18 23:59:24 +0100 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2019-01-18 23:59:24 +0100 |
commit | 0541eec0c82ae5a951cc73d65e17744e68f2e9c4 (patch) | |
tree | 8b59adc07bb064438e399783488145cf4fc42b2e /src | |
parent | 47c6942dd4128b592b7de82b2fd388030880fca6 (diff) | |
download | ryzomcore_searx-0541eec0c82ae5a951cc73d65e17744e68f2e9c4.tar.xz ryzomcore_searx-0541eec0c82ae5a951cc73d65e17744e68f2e9c4.zip |
Add khanindex nevrax search engine
Diffstat (limited to '')
-rw-r--r-- | src/khanindexer-nevrax.py | 50 | ||||
-rw-r--r-- | src/settings.yml | 5 |
2 files changed, 55 insertions, 0 deletions
diff --git a/src/khanindexer-nevrax.py b/src/khanindexer-nevrax.py new file mode 100644 index 0000000..e5dc66d --- /dev/null +++ b/src/khanindexer-nevrax.py @@ -0,0 +1,50 @@ +# khanindexer +# +# @website https://git.khaganat.net/neodarz/khanindexer +# +# @results JSON +# @stable yes +# @parse (general) url, title, content + +from urllib import urlencode +import json + +# engine dependent config +categories = ['general'] # TODO , 'images', 'music', 'videos', 'files' +paging = False +language_support = False +number_of_results = 5 + +# search-url +base_url = 'http://127.0.0.1:5000/?index=nevrax' +search_url = '&{query}' + + +# do search-request +def request(query, params): + + params['url'] = base_url +\ + search_url.format(query=urlencode({'search': query})) + + print(params['url']) + return params + + +# get response from search-request +def response(resp): + results = [] + + datas = json.loads(resp.text) + + if not 'error' in datas: + for el in datas: + results.append({ + 'title': el['title'], + 'content': el['excerpts'][0], + 'url': el['url'] + }) + else: + print("ERROR:Search server: "+str(datas['msg'])) + + # return results + return results diff --git a/src/settings.yml b/src/settings.yml index de6a2c4..af64618 100644 --- a/src/settings.yml +++ b/src/settings.yml @@ -73,6 +73,11 @@ engines: engine: khanindexer shortcut: kh + - name: khanindexer-nevrax + engine: khanindexer-nevrax + shortcut: khn + + locales: en : English |