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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. www.que-leer.com
  5. '''
  6.  
  7. import re
  8. from calibre.web.feeds.news import BasicNewsRecipe
  9.  
  10. class QueLeer(BasicNewsRecipe):
  11.     title                 = 'Que Leer'
  12.     __author__            = 'Darko Miletic'
  13.     description           = 'Libros, Novedades en libros, Criticas, Noticias libro'
  14.     publisher             = 'MC Ediciones, S.A.'
  15.     category              = 'news, books, criticas, libros'
  16.     oldest_article        = 7
  17.     max_articles_per_feed = 200
  18.     no_stylesheets        = True
  19.     encoding              = 'utf-8'
  20.     use_embedded_content  = False
  21.     language              = 'es'
  22.     remove_empty_feeds    = True
  23.     masthead_url          = 'http://www.que-leer.com/wp-content/themes/queleer/images/backgrounds/que-leer.jpg'
  24.     extra_css             = ' body{font-family: Arial,sans-serif } img{margin-bottom: 0.4em} '
  25.  
  26.     conversion_options = {
  27.                           'comment'   : description
  28.                         , 'tags'      : category
  29.                         , 'publisher' : publisher
  30.                         , 'language'  : language
  31.                         }
  32.  
  33.     preprocess_regexps = [(re.compile(r'<h2 class="izq">.*?</body>', re.DOTALL|re.IGNORECASE),lambda match: '')]
  34.  
  35.     remove_tags = [
  36.                      dict(attrs={'class':['post-ratings','post-ratings-loading','sociable','toc-anchor']})
  37.                     ,dict(name=['object','embed','iframe','link'])
  38.                     ,dict(attrs={'id':'left'})
  39.                   ]
  40.  
  41.     remove_tags_after = dict(attrs={'class':'sociable'})
  42.     remove_attributes = ['width','height']
  43.     keep_only_tags    = [dict(attrs={'class':'post'})]
  44.  
  45.     feeds = [(u'Articulos', u'http://www.que-leer.com/feed')]
  46.  
  47.     def preprocess_html(self, soup):
  48.         for item in soup.findAll(style=True):
  49.             del item['style']
  50.         url = 'http://www.que-leer.com/comprar-libros-tienda-que-leer/libros-recomendados'
  51.         fitem = soup.find('a',href=url)
  52.         if fitem:
  53.            par = fitem.parent
  54.            par.extract()
  55.         return self.adeify_images(soup)
  56.  
  57.