diff options
author | Adam Tauber <asciimoo@gmail.com> | 2018-02-18 22:42:32 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2018-02-18 22:42:32 +0100 |
commit | b4c657d227b3431b40b0ddd4ca000396a5abafde (patch) | |
tree | 40b94a1d045a5f0950c0852bae6e90a724835b78 /searx/engines | |
parent | f5be8206c82e3dc70daf7c26057f7b7f91911da3 (diff) | |
download | searxng-b4c657d227b3431b40b0ddd4ca000396a5abafde.tar.gz searxng-b4c657d227b3431b40b0ddd4ca000396a5abafde.zip |
[enh] add asksteem engine - closes #1163
Diffstat (limited to 'searx/engines')
-rw-r--r-- | searx/engines/asksteem.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/searx/engines/asksteem.py b/searx/engines/asksteem.py new file mode 100644 index 000000000..c3aa7ff68 --- /dev/null +++ b/searx/engines/asksteem.py @@ -0,0 +1,43 @@ +""" + Asksteem (general) + + @website https://asksteem.com/ + @provide-api yes + + @using-api yes + @results JSON (https://github.com/Hoxly/asksteem-docs/wiki) + @stable yes + @parse url, title, content +""" + +from json import loads +from searx.url_utils import urlencode + +# engine dependent config +categories = ['general'] +paging = True +language_support = False +disabled = True + +# search-url +search_url = 'https://api.asksteem.com/search?{params}' +result_url = 'https://steemit.com/@{author}/{title}' + + +# do search-request +def request(query, params): + url = search_url.format(params=urlencode({'q': query, 'pg': params['pageno']})) + params['url'] = url + return params + +# get response from search-request +def response(resp): + json = loads(resp.text) + + results = [] + + for result in json.get('results', []): + results.append({'url': result_url.format(author=result['author'], title=result['permlink']), + 'title': result['title'], + 'content': result['summary']}) + return results |