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 BangkokPostRecipe(BasicNewsRecipe): __license__ = 'GPL v3' __author__ = 'kwetal' language = 'en_TH' version = 1 title = 'Bangkok Post' publisher = 'Post Publishing PCL' category = 'News' description = "The world's window to Thailand" oldest_article = 7 max_articles_per_feed = 100 no_stylesheets = True remove_javascript = True use_embedded_content = False # Feeds from: http://www.bangkokpost.com/rss/ feeds = [] feeds.append(('Breaking News', 'http://www.bangkokpost.com/rss/data/breakingnews.xml')) feeds.append(('Top Stories', 'http://www.bangkokpost.com/rss/data/topstories.xml')) feeds.append(('News', 'http://www.bangkokpost.com/rss/data/news.xml')) feeds.append(('Business', 'http://www.bangkokpost.com/rss/data/business.xml')) feeds.append(('Opinion', 'http://www.bangkokpost.com/rss/data/opinion.xml')) feeds.append(('Travel', 'http://www.bangkokpost.com/rss/data/travel.xml')) feeds.append(('Leisure', 'http://www.bangkokpost.com/rss/data/leisure.xml')) feeds.append(('Entertainment', 'http://www.bangkokpost.com/rss/data/entertainment.xml')) feeds.append(('Auto', 'http://www.bangkokpost.com/rss/data/auto.xml')) feeds.append(('Life', 'http://www.bangkokpost.com/rss/data/life.xml')) feeds.append(('Tech', 'http://www.bangkokpost.com/rss/data/tect.xml')) keep_only_tags = [ classes('article-headline article-content'), ] def print_version(self, url): if '.com/vdo/' in url: url = None return url