From 72d063d27d9277b12efe2ec16fe1c95ef651c2a2 Mon Sep 17 00:00:00 2001 From: Denis Wernert Date: Mon, 8 Oct 2018 14:01:35 +0200 Subject: [PATCH] Uses the raw url for the image result, rather than the full size result. --- searx/engines/unsplash.py | 15 ++++++++------- 1 file 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