diff options
author | Denis Wernert <deniswernert@gmail.com> | 2018-10-08 14:01:35 +0200 |
---|---|---|
committer | Denis Wernert <deniswernert@gmail.com> | 2018-10-08 14:01:35 +0200 |
commit | 72d063d27d9277b12efe2ec16fe1c95ef651c2a2 (patch) | |
tree | 4b32cd28982d329f0192c9ba6cc416fc94e58472 /searx/engines/unsplash.py | |
parent | cd7849ffc82dc319e25ed80cae03dc021e5c7263 (diff) | |
download | searxng-72d063d27d9277b12efe2ec16fe1c95ef651c2a2.tar.gz searxng-72d063d27d9277b12efe2ec16fe1c95ef651c2a2.zip |
Uses the raw url for the image result, rather than the full
size result.
Diffstat (limited to 'searx/engines/unsplash.py')
-rw-r--r-- | searx/engines/unsplash.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/searx/engines/unsplash.py b/searx/engines/unsplash.py index 03db97788..04a943297 100644 --- a/searx/engines/unsplash.py +++ b/searx/engines/unsplash.py @@ -29,11 +29,12 @@ def response(resp): results = [] json_data = loads(resp.text) - for result in json_data['results']: - results.append({'template': 'images.html', - 'url': result['links']['html'], - 'thumbnail_src': result['urls']['thumb'], - 'img_src': result['urls']['full'], - 'title': result['description'], - 'content': ''}) + if 'results' in json_data: + for result in json_data['results']: + results.append({'template': 'images.html', + 'url': result['links']['html'], + 'thumbnail_src': result['urls']['thumb'], + 'img_src': result['urls']['raw'], + 'title': result['description'], + 'content': ''}) return results |