summaryrefslogtreecommitdiff
path: root/searx/engines/google_news.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2017-01-15 22:18:20 +0100
committerGitHub <noreply@github.com>2017-01-15 22:18:20 +0100
commit7a16aca346c14994f304a6961c55b63ab260265a (patch)
tree4cd44fc2fe23d17d1cb574042c98a276f04253c9 /searx/engines/google_news.py
parent627962ce40cd66d84f1be2d88907496fbd40b902 (diff)
parent1a9f8240b851c64a10be7b8990b6f3926ca506b3 (diff)
Merge branch 'master' into flask_perimeter
Diffstat (limited to 'searx/engines/google_news.py')
-rw-r--r--searx/engines/google_news.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py
index 49c6a5d50..6b79ff5c8 100644
--- a/searx/engines/google_news.py
+++ b/searx/engines/google_news.py
@@ -66,11 +66,14 @@ def response(resp):
# parse results
for result in dom.xpath('//div[@class="g"]|//div[@class="g _cy"]'):
- r = {
- 'url': result.xpath('.//div[@class="_cnc"]//a/@href')[0],
- 'title': ''.join(result.xpath('.//div[@class="_cnc"]//h3//text()')),
- 'content': ''.join(result.xpath('.//div[@class="st"]//text()')),
- }
+ try:
+ r = {
+ 'url': result.xpath('.//div[@class="_cnc"]//a/@href')[0],
+ 'title': ''.join(result.xpath('.//div[@class="_cnc"]//h3//text()')),
+ 'content': ''.join(result.xpath('.//div[@class="st"]//text()')),
+ }
+ except:
+ continue
imgs = result.xpath('.//img/@src')
if len(imgs) and not imgs[0].startswith('data'):