import re from calibre.web.feeds.news import BasicNewsRecipe class WNP(BasicNewsRecipe): title = 'WNP' cover_url = 'http://k.wnp.pl/images/wnpLogo.gif' __author__ = 'fenuks' description = 'Wirtualny Nowy Przemysł' category = 'economy' language = 'pl' preprocess_regexps = [ (re.compile('Czytaj też:.*?', re.DOTALL), lambda match: ''), # noqa: RUF039 (re.compile(r'Czytaj więcej:.*?', re.DOTALL), lambda match: ''), ] # noqa: RUF039 oldest_article = 8 max_articles_per_feed = 100 no_stylesheets = True remove_tags = [dict(attrs={'class': ['printF', 'border3B2 clearfix', 'articleMenu clearfix']})] feeds = [ ('Wiadomości gospodarcze', 'http://www.wnp.pl/rss/serwis_rss.xml'), ('Serwis Energetyka - Gaz', 'http://www.wnp.pl/rss/serwis_rss_1.xml'), ('Serwis Nafta - Chemia', 'http://www.wnp.pl/rss/serwis_rss_2.xml'), ('Serwis Hutnictwo', 'http://www.wnp.pl/rss/serwis_rss_3.xml'), ('Serwis Górnictwo', 'http://www.wnp.pl/rss/serwis_rss_4.xml'), ('Serwis Logistyka', 'http://www.wnp.pl/rss/serwis_rss_5.xml'), ('Serwis IT', 'http://www.wnp.pl/rss/serwis_rss_6.xml'), ] def print_version(self, url): return 'http://wnp.pl/drukuj/' + url[url.find(',') + 1 :]