From 20e41c7367e98386e53505a0c7a01529cdd9c243 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 20 Jul 2022 11:58:44 +0530 Subject: [PATCH] Fix images in kommersant --- recipes/kommersant.recipe | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/recipes/kommersant.recipe b/recipes/kommersant.recipe index 3e888f4c76..456e83c9ad 100644 --- a/recipes/kommersant.recipe +++ b/recipes/kommersant.recipe @@ -7,7 +7,7 @@ __copyright__ = '2010-2013, Darko Miletic ' www.kommersant.ru ''' -from calibre.web.feeds.news import BasicNewsRecipe +from calibre.web.feeds.news import BasicNewsRecipe, classes class Kommersant_ru(BasicNewsRecipe): @@ -40,12 +40,18 @@ class Kommersant_ru(BasicNewsRecipe): dict(name='div', attrs={'id': 'lenta'}), dict(name='div', attrs={'class': 'layout basement_news__body'}), dict(name='footer', attrs={'class': 'footer'}), - dict(name='div', attrs={'class': 'ui-modal'}), dict(name='section', attrs={'class': 'potd'}), dict(name='footer', attrs={'class': 'doc_footer'}), - dict(name='div', attrs={'class': 'adv_interscroll hide_desktop'}) + classes('ui-modal__hide'), + dict(name='div', attrs={'class': 'adv_interscroll hide_desktop'}), + dict(name=['button', 'source']), ] + def preprocess_html(self, soup): + for tag in soup.findAll(attrs={'data-lazyimage-src': True}): + tag['src'] = tag['data-lazyimage-src'] + return soup + feeds = [ ( '\u0413\u043B\u0430\u0432\u043D\u043E\u0435',