Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

Uses the raw url for the image result, rather than the full size result.

Denis Wernert72d063d27d92
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