mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
9e0e846f25
commit
a7a88de0f8
@ -266,7 +266,15 @@ class NewYorkTimes(BasicNewsRecipe):
|
||||
if article.get('description'):
|
||||
self.log('\t\t', article['description'])
|
||||
|
||||
container = soup.find(id='collection-{}'.format(slug)).find('section')
|
||||
cid = slug.split('/')[-1]
|
||||
if cid == 'dining':
|
||||
cid = 'food'
|
||||
try:
|
||||
container = soup.find(id='collection-{}'.format(cid)).find('section')
|
||||
except AttributeError:
|
||||
container = None
|
||||
if container is None:
|
||||
raise ValueError('Failed to find articles container for slug: {}'.format(slug))
|
||||
for ol in container.findAll('ol'):
|
||||
for article in self.parse_article_group(ol):
|
||||
log(article)
|
||||
|
@ -266,7 +266,15 @@ class NewYorkTimes(BasicNewsRecipe):
|
||||
if article.get('description'):
|
||||
self.log('\t\t', article['description'])
|
||||
|
||||
container = soup.find(id='collection-{}'.format(slug)).find('section')
|
||||
cid = slug.split('/')[-1]
|
||||
if cid == 'dining':
|
||||
cid = 'food'
|
||||
try:
|
||||
container = soup.find(id='collection-{}'.format(cid)).find('section')
|
||||
except AttributeError:
|
||||
container = None
|
||||
if container is None:
|
||||
raise ValueError('Failed to find articles container for slug: {}'.format(slug))
|
||||
for ol in container.findAll('ol'):
|
||||
for article in self.parse_article_group(ol):
|
||||
log(article)
|
||||
|
Loading…
x
Reference in New Issue
Block a user