Update Caravan Magazine

Fixes #1991486 [Private bug](https://bugs.launchpad.net/calibre/+bug/1991486)
This commit is contained in:
Kovid Goyal 2022-10-03 14:07:51 +05:30
parent 536fb6ff4f
commit 37c0477b0d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 10 additions and 4 deletions

View File

@ -28,14 +28,15 @@ class CaravanMagazine(BasicNewsRecipe):
no_stylesheets = True
keep_only_tags = [
classes('post-title short-desc author-details cover'),
dict(itemprop='articleBody'),
classes('post-title short-desc author-details cover'),
dict(itemprop='articleBody'),
]
remove_tags = [
dict(name='meta'),
dict(attrs={'class': ['share-with']}),
dict(attrs={'class': ['share-with', 'img-wrap abs']}),
]
remove_attributes = ['style']
def get_browser(self, *args, **kw):
br = BasicNewsRecipe.get_browser(self, *args, **kw)
@ -97,4 +98,6 @@ class CaravanMagazine(BasicNewsRecipe):
for div in soup.findAll(itemprop='image'):
for img in div.findAll('img'):
img['src'] = div['content']
for img in soup.findAll(attrs={'data-src': True}):
img['src'] = img['data-src']
return soup

View File

@ -35,8 +35,9 @@ class CaravanMagazineHindi(BasicNewsRecipe):
remove_tags = [
dict(name='meta'),
dict(attrs={'class': ['share-with']}),
dict(attrs={'class': ['share-with', 'img-wrap abs']}),
]
remove_attributes = ['style']
def get_browser(self, *args, **kw):
br = BasicNewsRecipe.get_browser(self, *args, **kw)
@ -111,4 +112,6 @@ class CaravanMagazineHindi(BasicNewsRecipe):
for div in soup.findAll(itemprop='image'):
for img in div.findAll('img'):
img['src'] = div['content']
for img in soup.findAll(attrs={'data-src': True}):
img['src'] = img['data-src']
return soup