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

  1. import re
  2. from calibre.web.feeds.news import BasicNewsRecipe
  3.  
  4. class PhysicsWorld(BasicNewsRecipe):
  5.     title          = u'Physicsworld'
  6.     description    = 'News from the world of physics'
  7.     __author__     = 'Hypernova'
  8.     language = 'en'
  9.  
  10.     oldest_article = 7
  11.     max_articles_per_feed = 100
  12.     no_stylesheets        = True
  13.     cover_url = 'http://images.iop.org/cws/icons/themes/phw/header-logo.png'
  14.     use_embedded_content  = False
  15.     remove_javascript     = True
  16.     needs_subscription = True
  17.     remove_tags_before = dict(name='h1')
  18.     remove_tags_after = [dict(name='div', attrs={'id':'shareThis'})]
  19.     preprocess_regexps = [
  20.    (re.compile(r'<div id="shareThis">.*</body>', re.DOTALL|re.IGNORECASE),
  21.     lambda match: '</body>'),
  22. ]
  23.     feeds          = [
  24.                           (u'Headlines News', u'http://feeds.feedburner.com/PhysicsWorldNews')
  25.                       ]
  26.  
  27.     def get_browser(self):
  28.         br = BasicNewsRecipe.get_browser(self)
  29.         if self.username is not None and self.password is not None:
  30.             br.open('http://physicsworld.com/cws/sign-in')
  31.             br.select_form(nr=2)
  32.             br['username'] = self.username
  33.             br['password'] = self.password
  34.             br.submit()
  35.         return br
  36.  
  37.  
  38.