summaryrefslogtreecommitdiff
path: root/searx/engines/google_news.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2016-12-23 12:59:03 +0100
committerAdam Tauber <asciimoo@gmail.com>2016-12-23 12:59:52 +0100
commit0171db5c3f6aca3e60af8b9e288dd6ea541e3e0c (patch)
tree936fa3aa50a05f63ed831efb25bae08eda34577e /searx/engines/google_news.py
parent4b225eb7efad8da442c9105b44b5c64fa5c01c21 (diff)
downloadsearxng-0171db5c3f6aca3e60af8b9e288dd6ea541e3e0c.tar.gz
searxng-0171db5c3f6aca3e60af8b9e288dd6ea541e3e0c.zip
[fix] handle missing images in google news
Diffstat (limited to 'searx/engines/google_news.py')
-rw-r--r--searx/engines/google_news.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py
index 37253c6a7..11357f3e6 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)