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

  1. #!/usr/bin/env python
  2. # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
  3. from __future__ import with_statement
  4.  
  5. __license__   = 'GPL v3'
  6. __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
  7. __docformat__ = 'restructuredtext en'
  8.  
  9.  
  10. from calibre.web.feeds.news import BasicNewsRecipe
  11.  
  12. class KellogInsight(BasicNewsRecipe):
  13.  
  14.     title          = 'Kellog Insight'
  15.     __author__     = 'Kovid Goyal and Sujata Raman'
  16.     description    = 'Articles from the Kellog School of Management'
  17.     no_stylesheets = True
  18.     encoding       = 'utf-8'
  19.     language = 'en'
  20.  
  21.     oldest_article = 60
  22.  
  23.     keep_only_tags = [dict(name='div', attrs={'id':['print_no_comments']})]
  24.  
  25.     remove_tags = [dict(name='div', attrs={'class':'col-three'})]
  26.  
  27.     extra_css = '''
  28.                 h1{font-family:arial; font-size:medium; color:#333333;}
  29.                 .col-one{font-family:arial; font-size:xx-small;}
  30.                 .col-two{font-family:arial; font-size:x-small; }
  31.                 h2{font-family:arial; font-size:small; color:#666666;}
  32.                 h3{font-family:arial; font-size:small; color:#333333;text-transform: uppercase; font-weight:normal;}
  33.                 h4{color:#660000;font-family:arial; font-size:x-small;}
  34.                 .col-two-text{font-family:arial; font-size:x-small; color:#333333;}
  35.                 '''
  36.  
  37.     feeds = [('Articles', 'http://insight.kellogg.northwestern.edu/index.php/Kellogg/RSS')]
  38.  
  39.     def get_article_url(self, article):
  40.         # Get only article not blog links
  41.         link = BasicNewsRecipe.get_article_url(self, article)
  42.         if link and '/article/' in link:
  43.             return link
  44.         self.log('Skipping non-article', link)
  45.         return None
  46.  
  47.     def preprocess_html(self, soup):
  48.  
  49.             for tag in soup.findAll(name=['span']):
  50.                 tag.nextSibling.name = 'h4'
  51.  
  52.             return soup
  53.  
  54.