summaryrefslogtreecommitdiff
path: root/searx/engines/flickr-noapi.py
diff options
context:
space:
mode:
authorCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-01-17 19:21:09 +0100
committerCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-01-17 19:21:09 +0100
commitcb4a3fe598707fc42f86ea3f7bcf517dcd4db660 (patch)
treef5ee1ea08f2b491c58806e236664c23389b8ff21 /searx/engines/flickr-noapi.py
parentedd9d311809d8f6eab5109f9cd899e7989bb42d5 (diff)
Add thumbnails in images results
- Modify engines to create/fetch an URL for the thumbnails - Modify themes to show thumbnails instead of full images. In Courgette, the result is not very beautiful. Should we change it ?
Diffstat (limited to 'searx/engines/flickr-noapi.py')
-rw-r--r--searx/engines/flickr-noapi.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/searx/engines/flickr-noapi.py b/searx/engines/flickr-noapi.py
index 89dd2ee5f..fdd8bc3eb 100644
--- a/searx/engines/flickr-noapi.py
+++ b/searx/engines/flickr-noapi.py
@@ -71,6 +71,14 @@ def response(resp):
if 'id' not in photo['owner']:
continue
+# For a bigger thumbnail, keep only the url_z, not the url_n
+ if 'n' in photo['sizes']:
+ thumbnail_src = photo['sizes']['n']['displayUrl']
+ elif 'z' in photo['sizes']:
+ thumbnail_src = photo['sizes']['z']['displayUrl']
+ else:
+ thumbnail_src = img_src
+
url = build_flickr_url(photo['owner']['id'], photo['id'])
title = photo.get('title', '')
@@ -89,6 +97,7 @@ def response(resp):
results.append({'url': url,
'title': title,
'img_src': img_src,
+ 'thumbnail_src': thumbnail_src,
'content': content,
'template': 'images.html'})