on master help sign in
[fix] handle missing images in google news
0171db5Adam Tauber
searx/engines/google_news.py+3−3
@@ -70,9 +70,9 @@ def response(resp):
70 'content': ''.join(result.xpath('.//div[@class="st"]//text()')),
70 'content': ''.join(result.xpath('.//div[@class="st"]//text()')),
71 }
71 }
72
72
73− img = result.xpath('.//img/@src')[0]
73+ imgs = result.xpath('.//img/@src')
74− if img and not img.startswith('data'):
74+ if len(imgs) and not imgs[0].startswith('data'):
75− r['img_src'] = img
75+ r['img_src'] = imgs[0]
76
76
77 results.append(r)
77 results.append(r)
78
78