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

  1.  
  2. __license__   = 'GPL v3'
  3. __copyright__ = '2009-2011, Darko Miletic <darko.miletic at gmail.com>'
  4. '''
  5. elmundo.es
  6. '''
  7.  
  8. from calibre.web.feeds.news import BasicNewsRecipe
  9.  
  10. class ElMundo(BasicNewsRecipe):
  11.     title                 = 'El Mundo'
  12.     __author__            = 'Darko Miletic'
  13.     description           = 'Lider de informacion en espaniol'
  14.     publisher             = 'Unidad Editorial Informacion General S.L.U.'
  15.     category              = 'news, politics, Spain'
  16.     oldest_article        = 2
  17.     max_articles_per_feed = 100
  18.     no_stylesheets        = True
  19.     use_embedded_content  = False
  20.     encoding              = 'iso8859_15'
  21.     language              = 'es'
  22.     masthead_url          = 'http://estaticos03.elmundo.es/elmundo/iconos/v4.x/v4.01/bg_h1.png'
  23.     publication_type      = 'newspaper'
  24.     extra_css             = """
  25.                                body{font-family: Arial,Helvetica,sans-serif}
  26.                                .metadata_noticia{font-size: small}
  27.                                h1,h2,h3,h4,h5,h6,.subtitulo {color: #3F5974}
  28.                                .hora{color: red}
  29.                                .update{color: gray}
  30.                             """
  31.  
  32.     conversion_options = {
  33.                              'comments'  : description
  34.                             ,'tags'      : category
  35.                             ,'language'  : language
  36.                             ,'publisher' : publisher
  37.                          }
  38.  
  39.     keep_only_tags     = [dict(name='div', attrs={'class':'noticia'})]
  40.     remove_tags_before = dict(attrs={'class':['titular','antetitulo']     })
  41.     remove_tags_after  = dict(name='div' , attrs={'id':['desarrollo_noticia','tamano']})
  42.     remove_attributes  = ['lang','border']
  43.     remove_tags = [
  44.                      dict(name='div', attrs={'class':['herramientas','publicidad_google']})
  45.                     ,dict(name='div', attrs={'id':'modulo_multimedia' })
  46.                     ,dict(name='ul', attrs={'class':'herramientas' })
  47.                     ,dict(name=['object','link','embed','iframe','base','meta'])
  48.                   ]
  49.  
  50.     feeds = [
  51.               (u'Portada'         , u'http://estaticos.elmundo.es/elmundo/rss/portada.xml'       )
  52.              ,(u'Deportes'        , u'http://estaticos.elmundo.es/elmundodeporte/rss/portada.xml')
  53.              ,(u'Economia'        , u'http://estaticos.elmundo.es/elmundo/rss/economia.xml'      )
  54.              ,(u'Espana'          , u'http://estaticos.elmundo.es/elmundo/rss/espana.xml'        )
  55.              ,(u'Internacional'   , u'http://estaticos.elmundo.es/elmundo/rss/internacional.xml' )
  56.              ,(u'Cultura'         , u'http://estaticos.elmundo.es/elmundo/rss/cultura.xml'       )
  57.              ,(u'Ciencia/Ecologia', u'http://estaticos.elmundo.es/elmundo/rss/ciencia.xml'       )
  58.              ,(u'Comunicacion'    , u'http://estaticos.elmundo.es/elmundo/rss/comunicacion.xml'  )
  59.              ,(u'Television'      , u'http://estaticos.elmundo.es/elmundo/rss/television.xml'    )
  60.             ]
  61.  
  62.     def preprocess_html(self, soup):
  63.         for item in soup.findAll(style=True):
  64.             del item['style']
  65.         return soup
  66.  
  67.     def get_article_url(self, article):
  68.         return article.get('guid',  None)
  69.  
  70.