mirror of https://github.com/searx/searx
[fix] handle missing images in google news
This commit is contained in:
parent
4b225eb7ef
commit
0171db5c3f
|
@ -70,9 +70,9 @@ def response(resp):
|
||||||
'content': ''.join(result.xpath('.//div[@class="st"]//text()')),
|
'content': ''.join(result.xpath('.//div[@class="st"]//text()')),
|
||||||
}
|
}
|
||||||
|
|
||||||
img = result.xpath('.//img/@src')[0]
|
imgs = result.xpath('.//img/@src')
|
||||||
if img and not img.startswith('data'):
|
if len(imgs) and not imgs[0].startswith('data'):
|
||||||
r['img_src'] = img
|
r['img_src'] = imgs[0]
|
||||||
|
|
||||||
results.append(r)
|
results.append(r)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue