from calibre.web.feeds.news import BasicNewsRecipe class GazetaWroclawska(BasicNewsRecipe): title = u'Gazeta Wroc\u0142awska' __author__ = 'fenuks' description = u'Gazeta Regionalna Gazeta Wrocławska. Najnowsze Wiadomości Wrocław, Informacje Wrocław. Czytaj!' category = 'newspaper' language = 'pl' encoding = 'iso-8859-2' masthead_url = 'http://s.polskatimes.pl/g/logo_naglowek/gazetawroclawska.png?24' oldest_article = 7 max_articles_per_feed = 100 remove_empty_feeds = True no_stylesheets = True use_embedded_content = False ignore_duplicate_articles = {'title', 'url'} remove_tags_after = dict(attrs={'src': 'http://nm.dz.com.pl/dz.png'}) remove_tags = [dict(id='mat-podobne'), dict(name='a', attrs={ 'class': 'czytajDalej'}), dict(attrs={'src': 'http://nm.dz.com.pl/dz.png'})] feeds = [ (u'Fakty24', u'http://gazetawroclawska.feedsportal.com/c/32980/f/533775/index.rss?201302'), (u'Region', u'http://www.gazetawroclawska.pl/rss/gazetawroclawska_region.xml?201302'), (u'Kultura', u'http://gazetawroclawska.feedsportal.com/c/32980/f/533777/index.rss?201302'), (u'Sport', u'http://gazetawroclawska.feedsportal.com/c/32980/f/533776/index.rss?201302'), (u'Z archiwum', u'http://www.gazetawroclawska.pl/rss/gazetawroclawska_zarchiwum.xml?201302'), (u'M\xf3j reporter', u'http://www.gazetawroclawska.pl/rss/gazetawroclawska_mojreporter.xml?201302'), (u'Historia', u'http://www.gazetawroclawska.pl/rss/gazetawroclawska_historia.xml?201302'), (u'Listy do redakcji', u'http://www.gazetawroclawska.pl/rss/gazetawroclawska_listydoredakcji.xml?201302'), (u'Na drogach', u'http://www.gazetawroclawska.pl/rss/gazetawroclawska_nadrogach.xml?201302')] def print_version(self, url): return url.replace('artykul', 'drukuj') def skip_ad_pages(self, soup): if 'Advertisement' in soup.title: nexturl = soup.find('a')['href'] return self.index_to_soup(nexturl, raw=True) def get_cover_url(self): soup = self.index_to_soup( 'http://www.prasa24.pl/gazeta/gazeta-wroclawska/') self.cover_url = soup.find(id='pojemnik').img['src'] return getattr(self, 'cover_url', self.cover_url)