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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2008-2011, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. spiegel.de
  5. '''
  6.  
  7. from calibre.web.feeds.news import BasicNewsRecipe
  8.  
  9. class Spiegel_int(BasicNewsRecipe):
  10.     title                 = 'Spiegel Online International'
  11.     __author__            = 'Darko Miletic and Sujata Raman'
  12.     description           = "Daily news, analysis and opinion from Europe's leading newsmagazine and Germany's top news Web site"
  13.     oldest_article        = 7
  14.     max_articles_per_feed = 100
  15.     language              = 'en_DE'
  16.     no_stylesheets        = True
  17.     use_embedded_content  = False
  18.     encoding              = 'cp1252'
  19.     publisher             = 'SPIEGEL ONLINE GmbH'
  20.     category              = 'news, politics, Germany'
  21.     masthead_url          = 'http://www.spiegel.de/static/sys/v9/spiegelonline_logo.png'
  22.     publication_type      = 'magazine'
  23.  
  24.     conversion_options = {
  25.                              'comments' : description
  26.                             ,'tags'     : category
  27.                             ,'language' : language
  28.                             ,'publisher': publisher
  29.                          }
  30.  
  31.     extra_css = '''
  32.                    #spArticleContent{font-family: Verdana,Arial,Helvetica,Geneva,sans-serif}
  33.                    h1{color:#666666; font-weight:bold;}
  34.                    h2{color:#990000;}
  35.                    h3{color:#990000;}
  36.                    h4 {color:#990000;}
  37.                    a{color:#990000;}
  38.                    .spAuthor{font-style:italic;}
  39.                    #spIntroTeaser{font-weight:bold}
  40.                    .spCredit{color:#666666; font-size:x-small;}
  41.                    .spShortDate{font-size:x-small;}
  42.                    .spArticleImageBox {font-size:x-small;}
  43.                    .spPhotoGallery{font-size:x-small; color:#990000 ;}
  44.                 '''
  45.  
  46.     keep_only_tags    = [dict(attrs={'id':'spArticleContent'})]
  47.     remove_tags_after = dict(attrs={'id':'spArticleBody'})
  48.     remove_tags       = [dict(name=['meta','base','iframe','embed','object'])]
  49.     remove_attributes = ['clear']
  50.     feeds             = [(u'Spiegel Online', u'http://www.spiegel.de/international/index.rss')]
  51.  
  52.     def print_version(self, url):
  53.         main, sep, rest = url.rpartition(',')
  54.         rmain, rsep, rrest = main.rpartition(',')
  55.         return rmain + ',druck-' + rrest + ',' + rest
  56.  
  57.     def preprocess_html(self, soup):
  58.         for item in soup.findAll(style=True):
  59.             del item['style']
  60.         for item in soup.findAll('a'):
  61.             if item.string is not None:
  62.                str = item.string
  63.                item.replaceWith(str)
  64.             else:
  65.                str = self.tag_to_string(item)
  66.                item.replaceWith(str)
  67.         return soup
  68.