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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __author__ = '2010, Gustavo Azambuja <hola at gazambuja.com>'
  5. '''
  6. http://www.revistabla.com
  7. '''
  8.  
  9. from calibre.web.feeds.news import BasicNewsRecipe
  10.  
  11. class Noticias(BasicNewsRecipe):
  12.     title                 = 'Revista Bla'
  13.     __author__            = 'Gustavo Azambuja'
  14.     description           = 'Moda | Uruguay'
  15.     language       = 'es_UY'
  16.     timefmt        = '[%a, %d %b, %Y]'
  17.     use_embedded_content  = False
  18.     recursion             = 5
  19.     encoding = 'utf8'
  20.     remove_javascript = True
  21.     no_stylesheets = True
  22.  
  23.     oldest_article        = 20
  24.     max_articles_per_feed = 100
  25.     keep_only_tags = [dict(id=['body_container'])]
  26.     remove_tags = [
  27.                  dict(name='div', attrs={'class':['date_text', 'comments', 'form_section', 'share_it']}),
  28.                  dict(name='div', attrs={'id':['relatedPosts', 'spacer', 'banner_izquierda', 'right_container']}),
  29.                  dict(name='p', attrs={'class':'FacebookLikeButton'}),
  30.                  dict(name=['object','link']) ]
  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'Articulos', u'http://www.revistabla.com/feed/')
  40.         ]
  41.  
  42.     def get_cover_url(self):
  43.     cover_url = None
  44.     index = 'http://www.revistabla.com'
  45.     soup = self.index_to_soup(index)
  46.     link_item = soup.find('div',attrs={'class':'header_right'})
  47.     if link_item:
  48.         cover_url = link_item.img['src']
  49.     return cover_url
  50.  
  51.     def preprocess_html(self, soup):
  52.         for item in soup.findAll(style=True):
  53.             del item['style']
  54.         return soup
  55.