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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
  5. '''
  6. lanacion.cl
  7. '''
  8. import urllib
  9.  
  10. from calibre.web.feeds.news import BasicNewsRecipe
  11.  
  12. class LaNacionChile(BasicNewsRecipe):
  13.     title                 = 'La Nacion Chile'
  14.     __author__            = 'Darko Miletic'
  15.     description           = 'El sitio de noticias online de Chile'
  16.     publisher             = 'La Nacion'
  17.     category              = 'news, politics, Chile'
  18.     oldest_article        = 2
  19.     max_articles_per_feed = 100
  20.     no_stylesheets        = True
  21.     use_embedded_content  = False
  22.     encoding              = 'cp1252'
  23.     cover_url             = 'http://www.lanacion.cl/prontus_noticias_v2/imag/site/logo.gif'
  24.     remove_javascript     = True
  25.  
  26.     html2lrf_options = [
  27.                           '--comment', description
  28.                         , '--category', category
  29.                         , '--publisher', publisher
  30.                         ]
  31.  
  32.     html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
  33.  
  34.     keep_only_tags = [dict(name='div', attrs={'class':'bloque'})]
  35.  
  36.     feeds = [(u'Noticias', u'http://www.lanacion.cl/rss.xml')]
  37.  
  38.     def print_version(self, url):
  39.         toprint = urllib.quote(url,':/')
  40.         return u'http://www.lanacion.cl/cgi-bx/imprimir.cgi?_URL=' + toprint
  41.  
  42.     def preprocess_html(self, soup):
  43.         del soup.body['onload']
  44.         soup.head.base.extract()
  45.         item = soup.find('a', attrs={'href':'javascript:window.close()'})
  46.         if item:
  47.            item.extract()
  48.         mtag = '<meta http-equiv="Content-Language" content="es-CL"/>'
  49.         soup.head.insert(0,mtag)
  50.         for item in soup.findAll(style=True):
  51.             del item['style']
  52.         return soup
  53.  
  54.     language = 'es_CL'
  55.