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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __author__ = '2010, Gustavo Azambuja <hola at gazambuja.com>'
  5. '''
  6. http://www.montevideo.com.uy
  7. '''
  8.  
  9. from calibre.web.feeds.news import BasicNewsRecipe
  10.  
  11. class Noticias(BasicNewsRecipe):
  12.     title                 = 'Montevideo COMM'
  13.     __author__            = 'Gustavo Azambuja'
  14.     description           = 'Noticias de Uruguay'
  15.     language       = 'es_UY'
  16.     timefmt        = '[%a, %d %b, %Y]'
  17.     use_embedded_content  = False
  18.     recursion             = 5
  19.     encoding = 'utf-8'
  20.     remove_javascript = True
  21.     no_stylesheets = True
  22.  
  23.     oldest_article        = 2
  24.     max_articles_per_feed = 100
  25.     keep_only_tags = [dict(id=['txt'])]
  26.     remove_tags = [
  27.              dict(name=['object','link'])
  28.                   ]
  29.  
  30.     remove_attributes = ['width','height', 'style', 'font', 'color']
  31.  
  32.     extra_css = '''
  33.                 h1{font-family:Geneva, Arial, Helvetica, sans-serif;color:#154B7A;}
  34.                 h3{font-size: 14px;color:#999999; font-family:Geneva, Arial, Helvetica, sans-serif;font-weight: bold;}
  35.                 h2{color:#666666; font-family:Geneva, Arial, Helvetica, sans-serif;font-size:small;}
  36.                 p {font-family:Arial,Helvetica,sans-serif;}
  37.                 '''
  38.     feeds = [
  39.            (u'Destacados', u'http://www.montevideo.com.uy/anxml.aspx?58'),
  40.            (u'Noticias', u'http://www.montevideo.com.uy/anxml.aspx?59'),
  41.            (u'Tecnologia', u'http://www.montevideo.com.uy/anxml.aspx?133'),
  42.            (u'Tiempo Libre', u'http://www.montevideo.com.uy/anxml.aspx?60'),
  43.            # (u'Deportes', u'http://www.montevideo.com.uy/anxml.aspx?968'),
  44.            # (u'Pantallazo', u'http://www.montevideo.com.uy/anxml.aspx?1022'),
  45.            (u'Gastronomia', u'http://www.montevideo.com.uy/anxml.aspx?1023')
  46.         ]
  47.  
  48.     def get_cover_url(self):
  49.         return 'http://sphotos.ak.fbcdn.net/hphotos-ak-snc1/hs276.snc1/10319_147339559330_147337559330_2625816_6636564_n.jpg'
  50.  
  51.  
  52.     def preprocess_html(self, soup):
  53.         for item in soup.findAll(style=True):
  54.             del item['style']
  55.         return soup
  56.  
  57.