mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update New York Magazine
This commit is contained in:
parent
815cd507b9
commit
f851d78e6a
@ -24,12 +24,10 @@ class NewYorkMagazine(BasicNewsRecipe):
|
||||
remove_javascript = True
|
||||
encoding = 'utf-8'
|
||||
keep_only_tags = [
|
||||
classes('lede-text headline-primary article-timestamp by-authors'),
|
||||
dict(id='main'),
|
||||
dict(itemprop='articleBody'),
|
||||
dict(name='article', attrs={'class':lambda x: x and 'article' in x.split()})
|
||||
]
|
||||
remove_tags = [
|
||||
classes('related-stories start-discussion'),
|
||||
classes('related-stories start-discussion newsletter-flex-text comments-link tags related secondary-area'),
|
||||
dict(id=['minibrowserbox', 'article-related', 'article-tools'])
|
||||
]
|
||||
remove_attributes = ['srcset']
|
||||
@ -70,6 +68,9 @@ class NewYorkMagazine(BasicNewsRecipe):
|
||||
return feeds
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
if lede := soup.findAll('div', attrs={'class':lambda x: x and 'lede-image-wrapper' in x.split()}):
|
||||
if len(lede) > 1:
|
||||
lede[1].extract()
|
||||
for img in soup.findAll('img', attrs={'data-src': True}):
|
||||
img['src'] = img['data-src']
|
||||
return soup
|
||||
|
Loading…
x
Reference in New Issue
Block a user