From 0171db5c3f6aca3e60af8b9e288dd6ea541e3e0c Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Fri, 23 Dec 2016 12:59:03 +0100 Subject: [PATCH] [fix] handle missing images in google news --- searx/engines/google_news.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py index 37253c6..11357f3 100644 --- a/searx/engines/google_news.py +++ b/searx/engines/google_news.py @@ -70,9 +70,9 @@ def response(resp): 'content': ''.join(result.xpath('.//div[@class="st"]//text()')), } - img = result.xpath('.//img/@src')[0] - if img and not img.startswith('data'): - r['img_src'] = img + imgs = result.xpath('.//img/@src') + if len(imgs) and not imgs[0].startswith('data'): + r['img_src'] = imgs[0] results.append(r)