Update The New Yorker

This commit is contained in:
Kovid Goyal 2014-12-09 07:37:47 +05:30
parent e9f1b2f726
commit 871a54b5a6

View File

@ -39,7 +39,15 @@ class NewYorker(BasicNewsRecipe):
if img is not None: if img is not None:
self.cover_url = img['src'].replace('-320.jpg', '.jpg') self.cover_url = img['src'].replace('-320.jpg', '.jpg')
articles = [] articles = []
for story in soup.findAll('article', itemtype='http://schema.org/NewsArticle'): current_section = 'Current Issue'
feeds = []
for story in soup.findAll(['h5', 'article'], itemtype=[None, 'http://schema.org/NewsArticle']):
if story.name == 'h5':
if articles:
feeds.append((current_section, articles))
current_section, articles = self.tag_to_string(story), []
self.log('\nFound section: ' + current_section)
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')
@ -58,7 +66,7 @@ class NewYorker(BasicNewsRecipe):
articles.append({'title':title, 'url':url, 'date':'', articles.append({'title':title, 'url':url, 'date':'',
'description':desc}) 'description':desc})
return [('Current Issue', articles)] return feeds
# The New Yorker changes the content it delivers based on cookies, so the # The New Yorker changes the content it delivers based on cookies, so the
# following ensures that we send no cookies # following ensures that we send no cookies