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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2008-2009, Darko Miletic <darko.miletic at gmail.com>'
  5. '''
  6. granma.cubaweb.cu
  7. '''
  8.  
  9. from calibre.web.feeds.news import BasicNewsRecipe
  10.  
  11. class Granma(BasicNewsRecipe):
  12.     title                 = 'Diario Granma'
  13.     __author__            = 'Darko Miletic'
  14.     description           = 'Organo oficial del Comite Central del Partido Comunista de Cuba'
  15.     publisher             = 'Granma'
  16.     category              = 'news, politics, Cuba'
  17.     oldest_article        = 2
  18.     max_articles_per_feed = 100
  19.     no_stylesheets        = True
  20.     use_embedded_content  = False
  21.     encoding              = 'cp1252'
  22.     cover_url             = 'http://www.granma.cubaweb.cu/imagenes/granweb229d.jpg'
  23.     language = 'es_CU'
  24.  
  25.     remove_javascript     = True
  26.  
  27.     html2lrf_options = [
  28.                           '--comment'  , description
  29.                         , '--category' , category
  30.                         , '--publisher', publisher
  31.                         , '--ignore-tables'
  32.                         ]
  33.  
  34.     html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True'
  35.  
  36.     keep_only_tags = [dict(name='table', attrs={'height':'466'})]
  37.  
  38.     remove_tags = [dict(name=['embed','link','object'])]
  39.  
  40.     feeds = [(u'Noticias', u'http://www.granma.cubaweb.cu/noticias.xml' )]
  41.  
  42.  
  43.     def preprocess_html(self, soup):
  44.         mtag = '<meta http-equiv="Content-Language" content="es-CU"/>'
  45.         soup.head.insert(0,mtag)
  46.         for item in soup.findAll('table'):
  47.             if item.has_key('width'):
  48.                del item['width']
  49.             if item.has_key('height'):
  50.                del item['height']
  51.         for item in soup.findAll(style=True):
  52.             del item['style']
  53.         return soup
  54.  
  55.