[fix] handle missing images in google news
commit0171db5c3f6aca3e60af8b9e288dd6ea541e3e0c
authorAdam Tauber <asciimoo@gmail.com>
dateFri 23 Dec 2016, 12:59 (10 years ago)
parent4b225eb
searx/engines/google_news.py+3−3
@@ -70,9 +70,9 @@ def response(resp):
7070 'content': ''.join(result.xpath('.//div[@class="st"]//text()')),
7171 }
7272
73− img = result.xpath('.//img/@src')[0]
74− if img and not img.startswith('data'):
75− r['img_src'] = img
73+ imgs = result.xpath('.//img/@src')
74+ if len(imgs) and not imgs[0].startswith('data'):
75+ r['img_src'] = imgs[0]
7676
7777 results.append(r)
7878