Fix NYT Today's paper front page section incomplete

This commit is contained in:
Kovid Goyal 2018-02-10 22:31:42 +05:30
parent 5b7569e1db
commit 0441e59905
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 14 additions and 4 deletions

View File

@ -106,10 +106,15 @@ class NewYorkTimes(BasicNewsRecipe):
soup = self.read_nyt_metadata()
section = soup.find(id='collection-todays-new-york-times')
feeds = []
for h1 in section.findAll('h1')[1:]:
for i, h1 in enumerate(section.findAll('h1')):
if i == 0:
continue
section_title = self.tag_to_string(h1)
self.log('Found section:', section_title)
articles = list(self.parse_todays_sections(h1.parent))
container = h1.parent
articles = list(self.parse_todays_sections(container))
if i == 1:
articles += list(self.parse_todays_sections(container.findNextSibling('div')))
if articles:
feeds.append((section_title, articles))
return feeds

View File

@ -106,10 +106,15 @@ class NewYorkTimes(BasicNewsRecipe):
soup = self.read_nyt_metadata()
section = soup.find(id='collection-todays-new-york-times')
feeds = []
for h1 in section.findAll('h1')[1:]:
for i, h1 in enumerate(section.findAll('h1')):
if i == 0:
continue
section_title = self.tag_to_string(h1)
self.log('Found section:', section_title)
articles = list(self.parse_todays_sections(h1.parent))
container = h1.parent
articles = list(self.parse_todays_sections(container))
if i == 1:
articles += list(self.parse_todays_sections(container.findNextSibling('div')))
if articles:
feeds.append((section_title, articles))
return feeds