From 53e1398ed6ad532686b7c4dd5c067559c5615e48 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 11 Feb 2018 20:16:02 +0530 Subject: [PATCH] Another nytimes parse todays page fix Fix all articles after front page being put into the internal section --- recipes/nytimes.recipe | 6 ++++-- recipes/nytimes_sub.recipe | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/recipes/nytimes.recipe b/recipes/nytimes.recipe index 4c49aa9964..1bb8ff280b 100644 --- a/recipes/nytimes.recipe +++ b/recipes/nytimes.recipe @@ -111,10 +111,12 @@ class NewYorkTimes(BasicNewsRecipe): continue section_title = self.tag_to_string(h1) self.log('Found section:', section_title) - container = h1.parent - articles = list(self.parse_todays_sections(container)) if i == 1: + container = h1.parent + articles = list(self.parse_todays_sections(container)) articles += list(self.parse_todays_sections(container.findNextSibling('div'))) + else: + articles = list(self.parse_todays_sections(h1.findNextSibling('ol'))) if articles: feeds.append((section_title, articles)) return feeds diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index d71966138b..fe6ddbf699 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -111,10 +111,12 @@ class NewYorkTimes(BasicNewsRecipe): continue section_title = self.tag_to_string(h1) self.log('Found section:', section_title) - container = h1.parent - articles = list(self.parse_todays_sections(container)) if i == 1: + container = h1.parent + articles = list(self.parse_todays_sections(container)) articles += list(self.parse_todays_sections(container.findNextSibling('div'))) + else: + articles = list(self.parse_todays_sections(h1.findNextSibling('ol'))) if articles: feeds.append((section_title, articles)) return feeds