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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. www.nursingtimes.net
  5. '''
  6.  
  7. import urllib
  8. from calibre.web.feeds.recipes import BasicNewsRecipe
  9.  
  10. class NursingTimes(BasicNewsRecipe):
  11.     title                  = 'Nursing Times'
  12.     __author__             = 'Darko Miletic'
  13.     description            = 'Nursing practice, NHS and health care news'
  14.     oldest_article         = 8
  15.     max_articles_per_feed  = 100
  16.     no_stylesheets         = True
  17.     use_embedded_content   = False
  18.     encoding               = 'utf-8'
  19.     publisher              = 'emap'
  20.     category               = 'news, health, nursing, UK'
  21.     language               = 'en_GB'
  22.     needs_subscription     = True
  23.     LOGIN                  = 'http://www.nursingtimes.net/sign-in'
  24.  
  25.     conversion_options = {
  26.                              'comments'        : description
  27.                             ,'tags'            : category
  28.                             ,'language'        : language
  29.                             ,'publisher'       : publisher
  30.                          }
  31.  
  32.     def get_browser(self):
  33.         br = BasicNewsRecipe.get_browser()
  34.         br.open(self.LOGIN)
  35.         if self.username is not None and self.password is not None:
  36.             data = urllib.urlencode({ 'campaigncode' :'0'
  37.                                      ,'referrer'     :''
  38.                                      ,'security_text':''
  39.                                      ,'SIemail'      :self.username
  40.                                      ,'passWord'     :self.password
  41.                                      ,'LoginButton.x':'27'
  42.                                      ,'LoginButton.y':'13'
  43.                                    })
  44.             br.open(self.LOGIN,data)
  45.         return br
  46.  
  47.     keep_only_tags   = [dict(name='div', attrs={'class':'storytext'})]
  48.     remove_tags      = [
  49.                           dict(name=['object','link','script','iframe'])
  50.                          ,dict(name='div',attrs={'id':'comments_form'})
  51.                        ]
  52.     remove_tags_after = dict(name='div',attrs={'id':'comments_form'})
  53.  
  54.     feeds = [
  55.                (u'Breaking News', u'http://www.nursingtimes.net/XmlServers/navsectionRSS.aspx?navsectioncode=1')
  56.               ,(u'Practice', u'http://www.nursingtimes.net/XmlServers/navsectionRSS.aspx?navsectioncode=512')
  57.               ,(u'Behind the headlines', u'http://www.nursingtimes.net/XmlServers/navsectionRSS.aspx?navsectioncode=468')
  58.               ,(u'Analysis', u'http://www.nursingtimes.net/XmlServers/navsectionRSS.aspx?navsectioncode=62')
  59.               ,(u'Acute care news', u'http://www.nursingtimes.net/XmlServers/navsectionRSS.aspx?navsectioncode=5')
  60.               ,(u'Primary vare news', u'http://www.nursingtimes.net/XmlServers/navsectionRSS.aspx?navsectioncode=231')
  61.               ,(u'Mental Health news', u'http://www.nursingtimes.net/XmlServers/navsectionRSS.aspx?navsectioncode=27')
  62.               ,(u'Management news', u'http://www.nursingtimes.net/XmlServers/navsectionRSS.aspx?navsectioncode=32')
  63.               ,(u"Older people's nursing news", u'http://www.nursingtimes.net/XmlServers/navsectionRSS.aspx?navsectioncode=181')
  64.               ,(u'Respiratory news', u'http://www.nursingtimes.net/XmlServers/navsectionRSS.aspx?navsectioncode=177')
  65.               ,(u'Wound care news', u'http://www.nursingtimes.net/XmlServers/navsectionRSS.aspx?navsectioncode=182')
  66.             ]
  67.  
  68.