logo

searx

My custom branche(s) on searx, a meta-search engine
commit: 27efdf38c8e068394a42269c4ce4e2cba461ee81
parent: 78081baa8fa311c052f41f3d39e3cb0a30b539f1
Author: Adam Tauber <asciimoo@gmail.com>
Date:   Tue, 27 Jan 2015 19:25:03 +0100

[fix] flickr-noapi logging ++ use correct image url - fixes #203 #181

Diffstat:

Msearx/engines/flickr-noapi.py11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git 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