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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. http://www.dilbert.com
  5. '''
  6.  
  7. from calibre.web.feeds.recipes import BasicNewsRecipe
  8. import re
  9.  
  10. class DilbertBig(BasicNewsRecipe):
  11.     title                  = 'Dilbert'
  12.     __author__             = 'Darko Miletic and Starson17'
  13.     description            = 'Dilbert'
  14.     reverse_article_order = True
  15.     oldest_article         = 15
  16.     max_articles_per_feed  = 100
  17.     no_stylesheets         = True
  18.     use_embedded_content   = True
  19.     encoding               = 'utf-8'
  20.     publisher              = 'UNITED FEATURE SYNDICATE, INC.'
  21.     category               = 'comic'
  22.     language               = 'en'
  23.  
  24.     conversion_options = {
  25.                              'comments'        : description
  26.                             ,'tags'            : category
  27.                             ,'language'        : language
  28.                             ,'publisher'       : publisher
  29.                          }
  30.  
  31.     feeds = [(u'Dilbert', u'http://feed.dilbert.com/dilbert/daily_strip' )]
  32.  
  33.     def get_article_url(self, article):
  34.         return article.get('feedburner_origlink', None)
  35.  
  36.     preprocess_regexps = [
  37.         (re.compile('strip\..*\.gif', re.DOTALL|re.IGNORECASE), lambda match: 'strip.zoom.gif')
  38.         ]
  39.  
  40.     def preprocess_html(self, soup):
  41.        for tag in soup.findAll(name='a'):
  42.            if tag['href'].find('http://feedads') >= 0:
  43.               tag.extract()
  44.        return soup
  45.  
  46.     extra_css = '''
  47.                     h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
  48.                     h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
  49.                     img {max-width:100%; min-width:100%;}
  50.                     p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
  51.                     body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
  52.         '''
  53.