home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_3736 < prev    next >
Encoding:
Text File  |  2010-04-28  |  2.1 KB  |  58 lines

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __author__ = '2010, Yuri Alvarez<me at yurialvarez.com>'
  5. __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
  6. '''
  7. observa.com.uy
  8. '''
  9.  
  10. from calibre.web.feeds.news import BasicNewsRecipe
  11.  
  12. class ObservaDigital(BasicNewsRecipe):
  13.     title                 = 'Observa Digital'
  14.     __author__            = 'yrvn'
  15.     description           = 'Noticias de Uruguay'
  16.     language       = 'es'
  17.     timefmt        = '[%a, %d %b, %Y]'
  18.     use_embedded_content  = False
  19.     recursion             = 5
  20.     encoding = 'utf8'
  21.     remove_javascript = True
  22.     no_stylesheets = True
  23.  
  24.     oldest_article        = 2
  25.     max_articles_per_feed = 100
  26.     keep_only_tags = [dict(id=['contenido'])]
  27.     remove_tags = [
  28.                      dict(name='div', attrs={'id':'contenedorVinculadas'}),
  29.              dict(name='p', attrs={'id':'nota_firma'}),
  30.              dict(name=['object','link'])
  31.                   ]
  32.  
  33.     extra_css = '''
  34.                 h1{font-family:Geneva, Arial, Helvetica, sans-serif;color:#154B7A;}
  35.                 h3{font-size: 14px;color:#999999; font-family:Geneva, Arial, Helvetica, sans-serif;font-weight: bold;}
  36.                 h2{color:#666666; font-family:Geneva, Arial, Helvetica, sans-serif;font-size:small;}
  37.                 p {font-family:Arial,Helvetica,sans-serif;}
  38.                 '''
  39.     feeds = [
  40.                (u'Actualidad', u'http://www.observa.com.uy/RSS/actualidad.xml'),
  41.            (u'Deportes', u'http://www.observa.com.uy/RSS/deportes.xml'),
  42.            (u'Vida', u'http://www.observa.com.uy/RSS/vida.xml'),
  43.            (u'Ciencia y Tecnologia', u'http://www.observa.com.uy/RSS/ciencia.xml')
  44.         ]
  45.  
  46.     def get_cover_url(self):
  47.         index = 'http://www.observa.com.uy/'
  48.         soup = self.index_to_soup(index)
  49.         for image in soup.findAll('img',alt=True):
  50.            if image['alt'].startswith('Tapa El Observador'):
  51.               return image['src'].rstrip('b.jpg') + '.jpg'
  52.         return None
  53.  
  54.     def preprocess_html(self, soup):
  55.         for item in soup.findAll(style=True):
  56.             del item['style']
  57.         return soup
  58.