Fix images in kommersant

This commit is contained in:
Kovid Goyal 2022-07-20 11:58:44 +05:30
parent 9f07e9aa8f
commit 20e41c7367
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -7,7 +7,7 @@ __copyright__ = '2010-2013, Darko Miletic <darko.miletic at gmail.com>'
www.kommersant.ru www.kommersant.ru
''' '''
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe, classes
class Kommersant_ru(BasicNewsRecipe): class Kommersant_ru(BasicNewsRecipe):
@ -40,12 +40,18 @@ class Kommersant_ru(BasicNewsRecipe):
dict(name='div', attrs={'id': 'lenta'}), dict(name='div', attrs={'id': 'lenta'}),
dict(name='div', attrs={'class': 'layout basement_news__body'}), dict(name='div', attrs={'class': 'layout basement_news__body'}),
dict(name='footer', attrs={'class': 'footer'}), dict(name='footer', attrs={'class': 'footer'}),
dict(name='div', attrs={'class': 'ui-modal'}),
dict(name='section', attrs={'class': 'potd'}), dict(name='section', attrs={'class': 'potd'}),
dict(name='footer', attrs={'class': 'doc_footer'}), 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 = [ feeds = [
( (
'\u0413\u043B\u0430\u0432\u043D\u043E\u0435', '\u0413\u043B\u0430\u0432\u043D\u043E\u0435',