home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_280 / st_petersburg_times.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. '''
  7. sptimes.ru
  8. '''
  9.  
  10. from calibre.web.feeds.news import BasicNewsRecipe
  11.  
  12. class PetersburgTimes(BasicNewsRecipe):
  13.     title                 = 'The St. Petersburg Times'
  14.     __author__            = 'Darko Miletic'
  15.     description           = 'News from Russia'
  16.     publisher             = 'sptimes.ru'
  17.     category              = 'news, politics, Russia'
  18.     max_articles_per_feed = 100
  19.     no_stylesheets        = True
  20.     remove_javascript     = True
  21.     encoding              = 'cp1251'
  22.     use_embedded_content  = False
  23.     language = 'en'
  24.  
  25.  
  26.     html2lrf_options = [
  27.                           '--comment', description
  28.                         , '--category', category
  29.                         , '--publisher', publisher
  30.                         , '--ignore-tables'
  31.                         ]
  32.  
  33.     html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True'
  34.  
  35.     remove_tags = [dict(name=['object','link','embed'])]
  36.  
  37.     feeds = [(u'Headlines', u'http://sptimes.ru/headlines.php' )]
  38.  
  39.     def preprocess_html(self, soup):
  40.         return self.adeify_images(soup)
  41.  
  42.     def get_article_url(self, article):
  43.         raw = article.get('guid',  None)
  44.         return raw
  45.  
  46.     def print_version(self, url):
  47.         start_url, question, article_id = url.rpartition('/')
  48.         return u'http://www.sptimes.ru/index.php?action_id=100&story_id=' + article_id
  49.  
  50.