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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
  5.  
  6. '''
  7. www.rts.rs
  8. '''
  9.  
  10. import re
  11. from calibre.web.feeds.news import BasicNewsRecipe
  12. from calibre.ebooks.BeautifulSoup import Tag
  13.  
  14. class RTS(BasicNewsRecipe):
  15.     title                 = 'RTS: Vesti'
  16.     __author__            = 'Darko Miletic'
  17.     description           = 'News from Serbia'
  18.     publisher             = 'RTS'
  19.     category              = 'news, politics, Serbia, RTS'
  20.     no_stylesheets        = True
  21.     encoding              = 'utf-8'
  22.     use_embedded_content  = True
  23.     language = 'sr'
  24.  
  25.     lang                  = 'sr-Latn-RS'
  26.     extra_css = '@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} body{font-family: serif1, serif} .article_description{font-family: serif1, serif}'
  27.  
  28.     conversion_options = {
  29.                           'comment'          : description
  30.                         , 'tags'             : category
  31.                         , 'publisher'        : publisher
  32.                         , 'language'         : lang
  33.                         , 'pretty_print'     : True
  34.                         }
  35.  
  36.  
  37.     preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
  38.  
  39.     feeds = [
  40.                (u'Vesti'         , u'http://www.rts.rs/page/stories/sr/rss.html'                 )
  41.               ,(u'Srbija'        , u'http://www.rts.rs/page/stories/sr/rss/9/Srbija.html'        )
  42.               ,(u'Region'        , u'http://www.rts.rs/page/stories/sr/rss/11/Region.html'       )
  43.               ,(u'Svet'          , u'http://www.rts.rs/page/stories/sr/rss/10/Svet.html'         )
  44.               ,(u'Hronika'       , u'http://www.rts.rs/page/stories/sr/rss/135/Hronika.html'     )
  45.               ,(u'Drustvo'       , u'http://www.rts.rs/page/stories/sr/rss/125/Dru%C5%A1tvo.html')
  46.               ,(u'Ekonomija'     , u'http://www.rts.rs/page/stories/sr/rss/13/Ekonomija.html'    )
  47.               ,(u'Nauka'         , u'http://www.rts.rs/page/stories/sr/rss/14/Nauka.html'        )
  48.               ,(u'Kultura'       , u'http://www.rts.rs/page/stories/sr/rss/16/Kultura.html'      )
  49.               ,(u'Zanimljivosti' , u'http://www.rts.rs/page/stories/sr/rss/15/Zanimljivosti.html')
  50.               ,(u'Sport'         , u'http://www.rts.rs/page/sport/sr/rss.html'                   )
  51.             ]
  52.  
  53.     def preprocess_html(self, soup):
  54.         soup.html['xml:lang'] = self.lang
  55.         soup.html['lang']     = self.lang
  56.         mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
  57.         mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=UTF-8")])
  58.         soup.head.insert(0,mlang)
  59.         soup.head.insert(1,mcharset)
  60.         return self.adeify_images(soup)
  61.  
  62.