from calibre.web.feeds.news import BasicNewsRecipe import re class Ciekawostki_Historyczne(BasicNewsRecipe): title = u'Ciekawostki Historyczne' oldest_article = 7 __author__ = u'fenuks & Tomasz Długosz' description = u'Serwis popularnonaukowy - odkrycia, kontrowersje, historia, ciekawostki, badania, ciekawostki z przeszłości.' category = 'history' language = 'pl' masthead_url = 'http://ciekawostkihistoryczne.pl/wp-content/themes/Wordpress_Magazine/images/logo-ciekawostki-historyczne-male.jpg' cover_url = 'http://ciekawostkihistoryczne.pl/wp-content/themes/Wordpress_Magazine/images/logo-ciekawostki-historyczne-male.jpg' max_articles_per_feed = 100 extra_css = 'img.alignleft {float:left; margin-right:5px;} .alignright {float:right; margin-left:5px;}' oldest_article = 12 preprocess_regexps = [(re.compile(u'Ten artykuł ma kilka stron.*?', re.DOTALL), lambda match: ''), (re.compile(u'

Zobacz też:

.*?', re.DOTALL), lambda match: '')] no_stylesheets = True remove_empty_feeds = True keep_only_tags = [dict(name='div', attrs={'class': 'post'})] recursions = 5 remove_tags = [dict(id=['catapult-cookie-bar','header','footer','rightcolumn','singlepostinfo']), dict( attrs={'class': ['ubm_banner','ciekawostki-slider-popular','books short floatRight', 'unprintable', 'booksTable', 'bawmrp']})] feeds = [ (u'Staro\u017cytno\u015b\u0107', u'http://ciekawostkihistoryczne.pl/tag/starozytnosc/feed/'), (u'\u015aredniowiecze', u'http://ciekawostkihistoryczne.pl/tag/sredniowiecze/feed/'), (u'Nowo\u017cytno\u015b\u0107', u'http://ciekawostkihistoryczne.pl/tag/nowozytnosc/feed/'), (u'XIX wiek', u'http://ciekawostkihistoryczne.pl/tag/xix-wiek/feed/'), (u'1914-1939', u'http://ciekawostkihistoryczne.pl/tag/1914-1939/feed/'), (u'1939-1945', u'http://ciekawostkihistoryczne.pl/tag/1939-1945/feed/'), (u'Powojnie (od 1945)', u'http://ciekawostkihistoryczne.pl/tag/powojnie/feed/'), (u'Recenzje', u'http://ciekawostkihistoryczne.pl/category/recenzje/feed/')] def is_link_wanted(self, url, tag): return 'ciekawostkihistoryczne' in url and url[-2] in {'2', '3', '4', '5', '6'} def postprocess_html(self, soup, first_fetch): tag = soup.find('h7') if tag: tag.nextSibling.extract() if not first_fetch: for r in soup.findAll(['h1']): r.extract() soup.find('h6').nextSibling.extract() return soup