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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2008-2011, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. ambito.com
  5. '''
  6.  
  7. from calibre.web.feeds.news import BasicNewsRecipe
  8.  
  9. class Ambito(BasicNewsRecipe):
  10.     title                 = 'Ambito.com'
  11.     __author__            = 'Darko Miletic'
  12.     description           = 'Ambito.com con noticias del Diario Ambito Financiero de Buenos Aires'
  13.     publisher             = 'Editorial Nefir S.A.'
  14.     category              = 'news, politics, economy, finances, Argentina'
  15.     oldest_article        = 2
  16.     no_stylesheets        = True
  17.     encoding              = 'cp1252'
  18.     masthead_url          = 'http://www.ambito.com/img/logo_.jpg'
  19.     use_embedded_content  = False
  20.     language              = 'es_AR'
  21.     publication_type      = 'newsportal'
  22.     extra_css             = """
  23.                                 body{font-family: "Trebuchet MS",Verdana,sans-serif}
  24.                                 .volanta{font-size: small}
  25.                                 .t2_portada{font-size: xx-large; font-family: Georgia,serif; color: #026698}
  26.                             """
  27.  
  28.  
  29.     conversion_options = {
  30.                           'comment'   : description
  31.                         , 'tags'      : category
  32.                         , 'publisher' : publisher
  33.                         , 'language'  : language
  34.                         }
  35.  
  36.     keep_only_tags    = [dict(name='div', attrs={'align':'justify'})]
  37.     remove_tags       = [dict(name=['object','link','embed','iframe','meta','link','table','img'])]
  38.     remove_attributes = ['align']
  39.  
  40.     feeds = [
  41.               (u'Principales Noticias', u'http://www.ambito.com/rss/noticiasp.asp'                         )
  42.              ,(u'Economia'            , u'http://www.ambito.com/rss/noticias.asp?S=Econom%EDa'             )
  43.              ,(u'Politica'            , u'http://www.ambito.com/rss/noticias.asp?S=Pol%EDtica'             )
  44.              ,(u'Informacion General' , u'http://www.ambito.com/rss/noticias.asp?S=Informaci%F3n%20General')
  45.              ,(u'Campo'               , u'http://www.ambito.com/rss/noticias.asp?S=Agro'                   )
  46.              ,(u'Internacionales'     , u'http://www.ambito.com/rss/noticias.asp?S=Internacionales'        )
  47.              ,(u'Deportes'            , u'http://www.ambito.com/rss/noticias.asp?S=Deportes'               )
  48.              ,(u'Espectaculos'        , u'http://www.ambito.com/rss/noticias.asp?S=Espect%E1culos'         )
  49.              ,(u'Tecnologia'          , u'http://www.ambito.com/rss/noticias.asp?S=Tecnolog%EDa'           )
  50.              ,(u'Ambito Nacional'     , u'http://www.ambito.com/rss/noticias.asp?S=Ambito%20Nacional'      )
  51.             ]
  52.  
  53.     def print_version(self, url):
  54.         return url.replace('/noticia.asp?','/noticias/imprimir.asp?')
  55.  
  56.     def preprocess_html(self, soup):
  57.         for item in soup.findAll(style=True):
  58.             del item['style']
  59.         for item in soup.findAll('a'):
  60.             str = item.string
  61.             if str is None:
  62.                str = self.tag_to_string(item)
  63.             item.replaceWith(str)
  64.         return soup
  65.