From 27efdf38c8e068394a42269c4ce4e2cba461ee81 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Tue, 27 Jan 2015 19:25:03 +0100 Subject: [PATCH] [fix] flickr-noapi logging ++ use correct image url - fixes #203 #181 --- searx/engines/flickr-noapi.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/searx/engines/flickr-noapi.py b/searx/engines/flickr-noapi.py index 66c6f402..9b28ded1 100644 --- a/searx/engines/flickr-noapi.py +++ b/searx/engines/flickr-noapi.py @@ -13,6 +13,10 @@ from urllib import urlencode from json import loads import re +from searx.engines import logger + + +logger = logger.getChild('flickr-noapi') categories = ['images'] @@ -62,10 +66,11 @@ def response(resp): # From the biggest to the lowest format for image_size in image_sizes: if image_size in photo['sizes']: - img_src = photo['sizes'][image_size]['displayUrl'] + img_src = photo['sizes'][image_size]['url'] break if not img_src: + logger.debug('cannot find valid image size: {0}'.format(repr(photo))) continue if 'id' not in photo['owner']: @@ -73,9 +78,9 @@ def response(resp): # For a bigger thumbnail, keep only the url_z, not the url_n if 'n' in photo['sizes']: - thumbnail_src = photo['sizes']['n']['displayUrl'] + thumbnail_src = photo['sizes']['n']['url'] elif 'z' in photo['sizes']: - thumbnail_src = photo['sizes']['z']['displayUrl'] + thumbnail_src = photo['sizes']['z']['url'] else: thumbnail_src = img_src