From d00558765d567215755d2e5136b895d3f17569ee Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 5 Dec 2018 10:02:39 +0530 Subject: [PATCH] Handle change to newsweek index page --- recipes/newsweek.recipe | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/newsweek.recipe b/recipes/newsweek.recipe index 44935102f1..09c3955b24 100644 --- a/recipes/newsweek.recipe +++ b/recipes/newsweek.recipe @@ -75,7 +75,10 @@ class Newsweek(BasicNewsRecipe): sections = defaultdict(list) for block in ('magazine-magazine-issue-story-list', 'editors-pick'): div = root.xpath( - '//div[@id="block-nw-{}"]'.format(block))[0] + '//div[@id="block-nw-{}"]'.format(block)) + if not div: + continue + div = div[0] for a in div.xpath(href_xpath): title = self.tag_to_string(a) article = a.xpath('ancestor::article')[0]