from calibre.web.feeds.news import BasicNewsRecipe def classes(classes): q = frozenset(classes.split(' ')) return dict(attrs={ 'class': lambda x: x and frozenset(x.split()).intersection(q)}) class WinnipegFreePress(BasicNewsRecipe): title = u'Winnipeg Free Press' __author__ = 'buyo' description = 'News from Winnipeg, Manitoba, Canada' oldest_article = 1 max_articles_per_feed = 15 category = 'News, Winnipeg, Canada' no_stylesheets = True encoding = 'UTF-8' remove_javascript = True use_embedded_content = False language = 'en_CA' extra_css = ''' .factbox { border: solid 2px; padding: 1rem } ''' feeds = [(u'Breaking News', u'http://www.winnipegfreepress.com/rss?path=/breakingnews'), (u'Local News', u'http://www.winnipegfreepress.com/rss?path=/local'), (u'Breaking Business News', u'http://www.winnipegfreepress.com/rss?path=/business/finance'), (u'Business', u'http://www.winnipegfreepress.com/rss?path=/business'), (u'Editorials', u'http://www.winnipegfreepress.com/rss?path=/opinion/editorials'), (u'Views from the West', u'http://www.winnipegfreepress.com/rss?path=/opinion/westview'), (u'Life & Style', u'http://www.winnipegfreepress.com/rss?path=/life'), (u'Food & Drink', u'http://www.winnipegfreepress.com/rss?path=/life/food') ] keep_only_tags = [ classes('article-title topphoto storycontent') ] remove_tags = [dict(name='button')]