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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. pressthink.org
  5. '''
  6.  
  7. from calibre.web.feeds.recipes import BasicNewsRecipe
  8.  
  9. class PressThink(BasicNewsRecipe):
  10.     title                  = 'PressThink'
  11.     __author__             = 'Darko Miletic'
  12.     description            = 'Ghost of democracy in the media machine'
  13.     oldest_article         = 60
  14.     max_articles_per_feed  = 100
  15.     no_stylesheets         = True
  16.     use_embedded_content   = False
  17.     encoding               = 'utf8'
  18.     publisher              = 'Arthur L. Carter Journalism Institute'
  19.     category               = 'news, USA, world, economy, politics, media'
  20.     language               = 'en'
  21.     publication_type       = 'blog'
  22.     extra_css              = """
  23.                                 body{ font-family: Helvetica,Arial,sans-serif }
  24.                                 img{display: block; margin-bottom: 0.5em}
  25.                                 h6{font-size: 1.1em; font-weight: bold}
  26.                                 .post-author{font-family: Georgia,serif}
  27.                                 .post-title{color: #AB0000}
  28.                                 .says{color: gray}
  29.                                 .comment {
  30.                                     border-bottom: 1px dotted #555555;
  31.                                     border-top: 1px dotted #DDDDDD;
  32.                                     margin-left: 10px;
  33.                                     min-height: 100px;
  34.                                     padding: 15px 0 20px;
  35.                                 }
  36.                              """
  37.  
  38.     conversion_options = {
  39.                              'comments' : description
  40.                             ,'tags'     : category
  41.                             ,'language' : language
  42.                             ,'publisher': publisher
  43.                          }
  44.  
  45.     remove_tags       = [dict(name=['form','iframe','embed','object','link','base','table','meta'])]
  46.     keep_only_tags    = [dict(attrs={'class':['post-title','post-author','entry','postmetadata alt','commentlist']})]
  47.  
  48.     feeds = [(u'Articles', u'http://pressthink.org/feed/')]
  49.  
  50.     def preprocess_html(self, soup):
  51.         for item in soup.findAll(style=True):
  52.             del item['style']
  53.         for item in soup.findAll('img', alt=False):
  54.             item['alt'] = 'image'
  55.         for alink in soup.findAll('a'):
  56.             if alink.string is not None:
  57.                tstr = alink.string
  58.                alink.replaceWith(tstr)
  59.         return soup
  60.  
  61.  
  62.