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
|
remove_javascript = True
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
classes('lede-text headline-primary article-timestamp by-authors'),
|
dict(name='article', attrs={'class':lambda x: x and 'article' in x.split()})
|
||||||
dict(id='main'),
|
|
||||||
dict(itemprop='articleBody'),
|
|
||||||
]
|
]
|
||||||
remove_tags = [
|
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'])
|
dict(id=['minibrowserbox', 'article-related', 'article-tools'])
|
||||||
]
|
]
|
||||||
remove_attributes = ['srcset']
|
remove_attributes = ['srcset']
|
||||||
@ -70,6 +68,9 @@ class NewYorkMagazine(BasicNewsRecipe):
|
|||||||
return feeds
|
return feeds
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
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}):
|
for img in soup.findAll('img', attrs={'data-src': True}):
|
||||||
img['src'] = img['data-src']
|
img['src'] = img['data-src']
|
||||||
return soup
|
return soup
|
||||||
|
Loading…
x
Reference in New Issue
Block a user