home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_280 / foreign_policy.recipe < prev    next >
Text File  |  2011-09-09  |  2KB  |  46 lines

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. www.foreignpolicy.com
  5. '''
  6.  
  7. from calibre.web.feeds.news import BasicNewsRecipe
  8.  
  9. class ForeignPolicy(BasicNewsRecipe):
  10.     title                 = 'Foreign Policy'
  11.     __author__            = 'Darko Miletic'
  12.     description           = 'International News'
  13.     publisher             = 'Washingtonpost.Newsweek Interactive, LLC'
  14.     category              = 'news, politics, USA'
  15.     oldest_article        = 31
  16.     max_articles_per_feed = 200
  17.     no_stylesheets        = True
  18.     encoding              = 'utf8'
  19.     use_embedded_content  = False
  20.     language              = 'en'
  21.     remove_empty_feeds    = True
  22.     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} '
  23.  
  24.     conversion_options = {
  25.                           'comment'   : description
  26.                         , 'tags'      : category
  27.                         , 'publisher' : publisher
  28.                         , 'language'  : language
  29.                         }
  30.  
  31.     keep_only_tags    = [dict(attrs={'id':['art-mast','art-body','auth-bio']})]
  32.     remove_tags       = [dict(name='iframe'),dict(attrs={'id':['share-box','base-ad']})]
  33.     remove_attributes = ['height','width']
  34.  
  35.  
  36.     feeds = [(u'Articles', u'http://www.foreignpolicy.com/node/feed')]
  37.  
  38.     def print_version(self, url):
  39.         return url + '?print=yes&page=full'
  40.  
  41.     def preprocess_html(self, soup):
  42.         for item in soup.findAll(style=True):
  43.             del item['style']
  44.         return soup
  45.  
  46.