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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
  5. '''
  6. www.thestar.com
  7. '''
  8.  
  9. from calibre.web.feeds.news import BasicNewsRecipe
  10.  
  11. class TheTorontoStar(BasicNewsRecipe):
  12.     title                 = 'The Toronto Star'
  13.     __author__            = 'Darko Miletic'
  14.     description           = "Canada's largest daily newspaper"
  15.     oldest_article        = 2
  16.     language              = 'en_CA'
  17.     max_articles_per_feed = 100
  18.     no_stylesheets        = True
  19.     use_embedded_content  = False
  20.     delay                 = 2
  21.     publisher             = 'The Toronto Star'
  22.     category              = "Toronto Star,Canada's largest daily newspaper,breaking news,classifieds,careers,GTA,Toronto Maple Leafs,sports,Toronto,news,editorial,The Star,Ontario,information,columnists,business,entertainment,births,deaths,automotive,rentals,weather,archives,Torstar,technology,Joseph Atkinson"
  23.     encoding              = 'utf-8'
  24.  
  25.     conversion_options = {
  26.                              'comments'    : description
  27.                             ,'tags'        : category
  28.                             ,'publisher'   : publisher
  29.                          }
  30.  
  31.     keep_only_tags = [dict(name='div', attrs={'class':'ts-article'})]
  32.     remove_tags_before = dict(name='div',attrs={'id':'ts-article_header'})
  33.  
  34.     feeds          = [
  35.                         (u'News'         , u'http://www.thestar.com/rss/82672?'    )
  36.                        ,(u'Opinion'     ,  u'http://www.thestar.com/rss/82863?'    )
  37.                        ,(u'Business'     , u'http://www.thestar.com/rss/82796?'    )
  38.                        ,(u'Sports'       , u'http://www.thestar.com/rss/82758?'    )
  39.                        ,(u'Entertainment', u'http://www.thestar.com/rss/117741?'    )
  40.                        ,(u'Living'       , u'http://www.thestar.com/rss/82839?'    )
  41.                        ,(u'Travel'       , u'http://www.thestar.com/rss/82858?'              )
  42.                        ,(u'Science'      , u'http://www.thestar.com/rss/82848?')
  43.                      ]
  44.  
  45.     def print_version(self, url):
  46.         artl = url.rpartition('--')[0]
  47.         artid = artl.rpartition('/')[2]
  48.         return 'http://www.thestar.com/printarticle/' + artid
  49.  
  50.