home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_4029 < prev    next >
Encoding:
Text File  |  2009-10-14  |  1.7 KB  |  52 lines

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
  5. '''
  6. seattletimes.nwsource.com
  7. '''
  8.  
  9. from calibre.web.feeds.news import BasicNewsRecipe
  10.  
  11. class SeattleTimes(BasicNewsRecipe):
  12.     title                 = 'The Seattle Times'
  13.     __author__            = 'Darko Miletic'
  14.     description           = 'News from Seattle and USA'
  15.     publisher             = 'The Seattle Times'
  16.     category              = 'news, politics, USA'
  17.     oldest_article        = 2
  18.     max_articles_per_feed = 100
  19.     no_stylesheets        = True
  20.     use_embedded_content  = False
  21.     encoding              = 'cp1252'
  22.     language = 'en'
  23.  
  24.  
  25.     html2lrf_options = [
  26.                           '--comment'  , description
  27.                         , '--category' , category
  28.                         , '--publisher', publisher
  29.                         ]
  30.  
  31.     html2epub_options  = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
  32.  
  33.     feeds              = [(u'Articles', u'http://seattletimes.nwsource.com/rss/seattletimes.xml')]
  34.  
  35.     remove_tags        = [
  36.                              dict(name=['object','link','script'])
  37.                             ,dict(name='p', attrs={'class':'permission'})
  38.                          ]
  39.  
  40.     def print_version(self, url):
  41.         start_url, sep, rest_url = url.rpartition('_')
  42.         rurl, rsep, article_id = start_url.rpartition('/')
  43.         return u'http://seattletimes.nwsource.com/cgi-bin/PrintStory.pl?document_id=' + article_id
  44.  
  45.     def preprocess_html(self, soup):
  46.         mtag = '<meta http-equiv="Content-Language" content="en-US"/>'
  47.         soup.head.insert(0,mtag)
  48.         for item in soup.findAll(style=True):
  49.             del item['style']
  50.         return soup
  51.  
  52.