__license__ = 'GPL v3' __copyright__ = '2010, Darko Miletic ' ''' www.foreignpolicy.com ''' from calibre.web.feeds.news import BasicNewsRecipe class ForeignPolicy(BasicNewsRecipe): title = 'Foreign Policy' __author__ = 'Darko Miletic' description = 'International News' publisher = 'Washingtonpost.Newsweek Interactive, LLC' category = 'news, politics, USA' oldest_article = 31 max_articles_per_feed = 200 no_stylesheets = True encoding = 'utf8' use_embedded_content = False language = 'en' remove_empty_feeds = True extra_css = ' body{font-family: Georgia,"Times New Roman",Times,serif } img{margin-bottom: 0.4em} h1,h2,h3,h4,h5,h6{font-family: Arial,Helvetica,sans-serif} ' conversion_options = { 'comment' : description , 'tags' : category , 'publisher' : publisher , 'language' : language } keep_only_tags = [dict(attrs={'id':['art-mast','art-body','auth-bio']})] remove_tags = [dict(name='iframe'),dict(attrs={'id':['share-box','base-ad']})] remove_attributes = ['height','width'] feeds = [(u'Articles', u'http://www.foreignpolicy.com/node/feed')] def print_version(self, url): return url + '?print=yes&page=full' def preprocess_html(self, soup): for item in soup.findAll(style=True): del item['style'] return soup