mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Open Magazine
This commit is contained in:
parent
92bef3ec5e
commit
da2635b9df
@ -17,12 +17,14 @@ class OpenMagazine(BasicNewsRecipe):
|
|||||||
masthead_url = 'https://openthemagazine.com/wp-content/themes/open/images/logo.png'
|
masthead_url = 'https://openthemagazine.com/wp-content/themes/open/images/logo.png'
|
||||||
ignore_duplicate_articles = {'url'}
|
ignore_duplicate_articles = {'url'}
|
||||||
extra_css = '[id^="caption-attachment"] {font-size: small;font-style: italic;}'
|
extra_css = '[id^="caption-attachment"] {font-size: small;font-style: italic;}'
|
||||||
|
'blockquote{color:#404040;}'
|
||||||
|
'.about-author{font-size:small;}'
|
||||||
|
|
||||||
def get_cover_url(self):
|
def get_cover_url(self):
|
||||||
soup = self.index_to_soup('https://openthemagazine.com/')
|
soup = self.index_to_soup('https://openthemagazine.com/')
|
||||||
tag = soup.find(attrs={'class': 'magazine-item mr-1'})
|
tag = soup.find(attrs={'class': 'magazine-item mr-1'})
|
||||||
if tag:
|
if tag:
|
||||||
self.cover_url = tag.find('img')['src']
|
self.cover_url = tag.find('img')['data-src']
|
||||||
return getattr(self, 'cover_url', None)
|
return getattr(self, 'cover_url', None)
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
@ -46,3 +48,8 @@ class OpenMagazine(BasicNewsRecipe):
|
|||||||
('Art & Culture', 'https://openthemagazine.com/art-culture/feed'),
|
('Art & Culture', 'https://openthemagazine.com/art-culture/feed'),
|
||||||
('Cinema', 'https://openthemagazine.com/cinema/feed'),
|
('Cinema', 'https://openthemagazine.com/cinema/feed'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
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