home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_4120 < prev    next >
Encoding:
Text File  |  2009-10-14  |  2.5 KB  |  64 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.vecernji.hr
  8. '''
  9.  
  10. import re
  11. from calibre.web.feeds.recipes import BasicNewsRecipe
  12. from calibre.ebooks.BeautifulSoup import Tag
  13.  
  14. class VecernjiList(BasicNewsRecipe):
  15.     title                 = 'Vecernji List'
  16.     __author__            = 'Darko Miletic'
  17.     description           = "Vecernji.hr je vodeci hrvatski news portal. Cilj je biti prvi u objavljivanju svih vijesti iz Hrvatske, svijeta, sporta, gospodarstva, showbiza i jos mnogo vise. Uz cjelodnevni rad, novinari objavljuju preko 300 raznih vijesti svakoga dana. Vecernji.hr prati sve vaznije dogadaje specijalnim izvjestajima, video specijalima i foto galerijama."
  18.     publisher             = 'Vecernji.hr'
  19.     category              = 'news, politics, Croatia'
  20.     oldest_article        = 2
  21.     max_articles_per_feed = 100
  22.     delay                 = 1
  23.     no_stylesheets        = True
  24.     encoding              = 'utf-8'
  25.     use_embedded_content  = False
  26.     language = 'hr'
  27.  
  28.     lang                 = 'hr-HR'
  29.     direction            = 'ltr'
  30.  
  31.     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}'
  32.  
  33.     conversion_options = {
  34.                           'comment'          : description
  35.                         , 'tags'             : category
  36.                         , 'publisher'        : publisher
  37.                         , 'language'         : lang
  38.                         , 'pretty_print'     : True
  39.                         }
  40.  
  41.     preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
  42.  
  43.     remove_tags = [
  44.                     dict(name=['object','link','embed'])
  45.                    ,dict(name='table', attrs={'class':'enumbox'})
  46.                   ]
  47.  
  48.     feeds = [(u'Vijesti', u'http://www.vecernji.hr/rss/')]
  49.  
  50.     def preprocess_html(self, soup):
  51.         soup.html['lang'] = self.lang
  52.         soup.html['dir' ] = self.direction
  53.  
  54.         mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
  55.         mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=UTF-8")])
  56.         soup.head.insert(0,mlang)
  57.         soup.head.insert(1,mcharset)
  58.         return self.adeify_images(soup)
  59.  
  60.     def print_version(self, url):
  61.         artid = url.rpartition('-')[2]
  62.         return 'http://www.vecernji.hr/index.php?cmd=show_clanak&action=print_popup&clanak_id='+artid
  63.  
  64.