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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
  5. '''
  6. tanjug.rs
  7. '''
  8. import re
  9. from calibre.web.feeds.news import BasicNewsRecipe
  10. from calibre.ebooks.BeautifulSoup import Tag
  11.  
  12. class Tanjug(BasicNewsRecipe):
  13.     title                 = 'Tanjug'
  14.     __author__            = 'Darko Miletic'
  15.     description           = 'Novinska agencija TANJUG - Dnevne vesti iz Srbije i sveta'
  16.     publisher             = 'Tanjug'
  17.     category              = 'news, politics, Serbia'
  18.     oldest_article        = 2
  19.     max_articles_per_feed = 100
  20.     use_embedded_content  = True
  21.     encoding              = 'utf-8'
  22.     lang                  = 'sr-Latn-RS'
  23.     language = 'sr'
  24.  
  25.     direction             = 'ltr'
  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.     preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
  37.  
  38.     feeds          = [(u'Vesti', u'http://www.tanjug.rs/StaticPages/RssTanjug.aspx')]
  39.  
  40.     def preprocess_html(self, soup):
  41.         soup.html['xml:lang'] = self.lang
  42.         soup.html['lang'    ] = self.lang
  43.         soup.html['dir'     ] = self.direction
  44.         mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
  45.         soup.head.insert(0,mlang)
  46.         return self.adeify_images(soup)
  47.