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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. www.losandes.com.ar
  5. '''
  6.  
  7. from calibre import strftime
  8. from calibre.web.feeds.news import BasicNewsRecipe
  9.  
  10. class LosAndes(BasicNewsRecipe):
  11.     title                 = 'Los Andes'
  12.     __author__            = 'Darko Miletic'
  13.     description           = 'Noticias de Mendoza, Argentina y el resto del mundo'
  14.     publisher             = 'Los Andes'
  15.     category              = 'news, politics, Argentina'
  16.     oldest_article        = 2
  17.     max_articles_per_feed = 200
  18.     no_stylesheets        = True
  19.     encoding              = 'cp1252'
  20.     use_embedded_content  = False
  21.     language              = 'es_AR'
  22.     remove_empty_feeds    = True
  23.     publication_type      = 'newspaper'
  24.     masthead_url          = 'http://www.losandes.com.ar/graficos/losandes.png'
  25.     extra_css             = """
  26.                                body{font-family: Arial,Helvetica,sans-serif }
  27.                                h1,h2{font-family: "Times New Roman",Times,serif}
  28.                                .fechaNota{font-weight: bold; color: gray}
  29.                             """
  30.  
  31.     conversion_options = {
  32.                           'comment'   : description
  33.                         , 'tags'      : category
  34.                         , 'publisher' : publisher
  35.                         , 'language'  : language
  36.                         }
  37.  
  38.     remove_tags = [
  39.                      dict(name=['meta','link'])
  40.                     ,dict(attrs={'class':['cabecera', 'url']})
  41.                   ]
  42.     remove_tags_before=dict(attrs={'class':'cabecera'})
  43.     remove_tags_after=dict(attrs={'class':'url'})
  44.  
  45.  
  46.     feeds = [
  47.               (u'Ultimas Noticias'       , u'http://www.losandes.com.ar/servicios/rss.asp?r=78' )
  48.              ,(u'Politica'               , u'http://www.losandes.com.ar/servicios/rss.asp?r=68' )
  49.              ,(u'Economia nacional'      , u'http://www.losandes.com.ar/servicios/rss.asp?r=65' )
  50.              ,(u'Economia internacional' , u'http://www.losandes.com.ar/servicios/rss.asp?r=505')
  51.              ,(u'Internacionales'        , u'http://www.losandes.com.ar/servicios/rss.asp?r=66' )
  52.              ,(u'Turismo'                , u'http://www.losandes.com.ar/servicios/rss.asp?r=502')
  53.              ,(u'Fincas'                 , u'http://www.losandes.com.ar/servicios/rss.asp?r=504')
  54.              ,(u'Isha nos habla'         , u'http://www.losandes.com.ar/servicios/rss.asp?r=562')
  55.              ,(u'Estilo'                 , u'http://www.losandes.com.ar/servicios/rss.asp?r=81' )
  56.              ,(u'Cultura'                , u'http://www.losandes.com.ar/servicios/rss.asp?r=503')
  57.              ,(u'Policiales'             , u'http://www.losandes.com.ar/servicios/rss.asp?r=70' )
  58.              ,(u'Deportes'               , u'http://www.losandes.com.ar/servicios/rss.asp?r=69' )
  59.              ,(u'Sociedad'               , u'http://www.losandes.com.ar/servicios/rss.asp?r=67' )
  60.              ,(u'Opinion'                , u'http://www.losandes.com.ar/servicios/rss.asp?r=80' )
  61.              ,(u'Editorial'              , u'http://www.losandes.com.ar/servicios/rss.asp?r=76' )
  62.              ,(u'Mirador'                , u'http://www.losandes.com.ar/servicios/rss.asp?r=79' )
  63.             ]
  64.  
  65.     def print_version(self, url):
  66.         artid = url.rpartition('.')[0].rpartition('-')[2]
  67.         return "http://www.losandes.com.ar/includes/modulos/imprimir.asp?tipo=noticia&id=" + artid
  68.  
  69.     def get_cover_url(self):
  70.         month = strftime("%m").lstrip('0')
  71.         day   = strftime("%d").lstrip('0')
  72.         year  = strftime("%Y")
  73.         return "http://www.losandes.com.ar/fotografias/fotosnoticias/" + year + "/" + month + "/" + day + "/th_tapa.jpg"
  74.  
  75.     def preprocess_html(self, soup):
  76.         for item in soup.findAll(style=True):
  77.             del item['style']
  78.         return soup
  79.