Update The New Yorker

This commit is contained in:
Kovid Goyal 2015-07-31 09:07:11 +05:30
parent 5779af5140
commit db54fbeca0

View File

@ -41,13 +41,15 @@ class NewYorker(BasicNewsRecipe):
articles = [] articles = []
current_section = 'Current Issue' current_section = 'Current Issue'
feeds = [] feeds = []
for story in soup.findAll(['h5', 'article'], itemtype=[None, 'http://schema.org/NewsArticle']): for story in soup.findAll(['h5', 'article']):
if story.name == 'h5': if story.name == 'h5':
if articles: if articles:
feeds.append((current_section, articles)) feeds.append((current_section, articles))
current_section, articles = self.tag_to_string(story), [] current_section, articles = self.tag_to_string(story), []
self.log('\nFound section: ' + current_section) self.log('\nFound section: ' + current_section)
continue continue
if story['itemtype'] != 'http://schema.org/Article':
continue
h2 = story.find('h2') h2 = story.find('h2')
url = h2.find('a', href=True)['href'] url = h2.find('a', href=True)['href']
a = h2.find('a') a = h2.find('a')