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

  1. #!/usr/bin/env  python
  2.  
  3. import re
  4. from calibre.web.feeds.news import BasicNewsRecipe
  5. from calibre.ebooks.BeautifulSoup import Tag
  6.  
  7. class SBM(BasicNewsRecipe):
  8.     title                 = 'Science Based Medicine'
  9.     __author__            = 'BuzzKill'
  10.     description           = 'Exploring issues and controversies in the relationship between science and medicine'
  11.     oldest_article        = 5
  12.     max_articles_per_feed = 15
  13.     no_stylesheets        = True
  14.     use_embedded_content  = False
  15.     encoding              = 'utf-8'
  16.     publisher             = 'SBM'
  17.     category              = 'science, sbm, ebm, blog, pseudoscience'
  18.     language              = 'en'
  19.  
  20.     lang                  = 'en-US'
  21.  
  22.     conversion_options = {
  23.                           'comment'          : description
  24.                         , 'tags'             : category
  25.                         , 'publisher'        : publisher
  26.                         , 'language'         : lang
  27.                         , 'pretty_print'     : True
  28.                         }
  29.  
  30.     keep_only_tags = [
  31.                       dict(name='a', attrs={'title':re.compile(r'Posts by.*', re.DOTALL|re.IGNORECASE)}),
  32.                       dict(name='div', attrs={'class':'entry'})
  33.                       ]
  34.  
  35.     feeds = [(u'Science Based Medicine', u'http://www.sciencebasedmedicine.org/?feed=rss2')]
  36.  
  37.     def preprocess_html(self, soup):
  38.         mtag = Tag(soup,'meta',[('http-equiv','Content-Type'),('context','text/html; charset=utf-8')])
  39.         soup.head.insert(0,mtag)
  40.         soup.html['lang'] = self.lang
  41.         return self.adeify_images(soup)
  42.  
  43.