Another nytimes parse todays page fix

Fix all articles after front page being put into the internal section
This commit is contained in:
Kovid Goyal 2018-02-11 20:16:02 +05:30
parent b2ab2bfd6a
commit 53e1398ed6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 4 deletions

View File

@ -111,10 +111,12 @@ class NewYorkTimes(BasicNewsRecipe):
continue continue
section_title = self.tag_to_string(h1) section_title = self.tag_to_string(h1)
self.log('Found section:', section_title) self.log('Found section:', section_title)
if i == 1:
container = h1.parent container = h1.parent
articles = list(self.parse_todays_sections(container)) articles = list(self.parse_todays_sections(container))
if i == 1:
articles += list(self.parse_todays_sections(container.findNextSibling('div'))) articles += list(self.parse_todays_sections(container.findNextSibling('div')))
else:
articles = list(self.parse_todays_sections(h1.findNextSibling('ol')))
if articles: if articles:
feeds.append((section_title, articles)) feeds.append((section_title, articles))
return feeds return feeds

View File

@ -111,10 +111,12 @@ class NewYorkTimes(BasicNewsRecipe):
continue continue
section_title = self.tag_to_string(h1) section_title = self.tag_to_string(h1)
self.log('Found section:', section_title) self.log('Found section:', section_title)
if i == 1:
container = h1.parent container = h1.parent
articles = list(self.parse_todays_sections(container)) articles = list(self.parse_todays_sections(container))
if i == 1:
articles += list(self.parse_todays_sections(container.findNextSibling('div'))) articles += list(self.parse_todays_sections(container.findNextSibling('div')))
else:
articles = list(self.parse_todays_sections(h1.findNextSibling('ol')))
if articles: if articles:
feeds.append((section_title, articles)) feeds.append((section_title, articles))
return feeds return feeds