Update Open Magazine

This commit is contained in:
Kovid Goyal 2022-09-04 18:11:30 +05:30
parent 92bef3ec5e
commit da2635b9df
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -17,12 +17,14 @@ class OpenMagazine(BasicNewsRecipe):
masthead_url = 'https://openthemagazine.com/wp-content/themes/open/images/logo.png'
ignore_duplicate_articles = {'url'}
extra_css = '[id^="caption-attachment"] {font-size: small;font-style: italic;}'
'blockquote{color:#404040;}'
'.about-author{font-size:small;}'
def get_cover_url(self):
soup = self.index_to_soup('https://openthemagazine.com/')
tag = soup.find(attrs={'class': 'magazine-item mr-1'})
if tag:
self.cover_url = tag.find('img')['src']
self.cover_url = tag.find('img')['data-src']
return getattr(self, 'cover_url', None)
keep_only_tags = [
@ -46,3 +48,8 @@ class OpenMagazine(BasicNewsRecipe):
('Art & Culture', 'https://openthemagazine.com/art-culture/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