Merge branch 'recipe-foreignaffairs-fix' of https://github.com/ping/calibre

This commit is contained in:
Kovid Goyal 2023-10-30 16:56:53 +05:30
commit 489ecd08d3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -180,9 +180,8 @@ class ForeignAffairsRecipe(BasicNewsRecipe):
return html.tostring(root, encoding='unicode') return html.tostring(root, encoding='unicode')
def preprocess_html(self, soup): def preprocess_html(self, soup):
for attr in ('ng-src', 'data-blazy', 'data-src'): for img in soup.find_all('img', attrs={'srcset': True}):
for img in soup.findAll('img', attrs={attr: True}): img['src'] = img['srcset'].split(',')[-1].strip().split(' ')[0].strip()
img['src'] = img[attr]
return soup return soup
def get_browser(self): def get_browser(self):