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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
  3.  
  4. '''
  5. www.alo.rs
  6. '''
  7.  
  8. import re
  9. from calibre.web.feeds.recipes import BasicNewsRecipe
  10.  
  11. class Alo_Novine(BasicNewsRecipe):
  12.     title                 = 'Alo!'
  13.     __author__            = 'Darko Miletic'
  14.     description           = "News Portal from Serbia"
  15.     publisher             = 'Alo novine d.o.o.'
  16.     category              = 'news, politics, Serbia'
  17.     oldest_article        = 2
  18.     max_articles_per_feed = 100
  19.     delay                 = 4
  20.     no_stylesheets        = True
  21.     encoding              = 'utf-8'
  22.     use_embedded_content  = False
  23.     language              = 'sr'
  24.     extra_css             = """
  25.                                 @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)}
  26.                                 .article_description,body{font-family: Arial,Helvetica,sans1,sans-serif}
  27.                                 .lead {font-size: 1.3em}
  28.                                 h1{color: #DB0700}
  29.                                 .article_uvod{font-style: italic; font-size: 1.2em}
  30.                                 img{margin-bottom: 0.8em} """
  31.  
  32.     conversion_options = {
  33.                           'comment'  : description
  34.                         , 'tags'     : category
  35.                         , 'publisher': publisher
  36.                         , 'language' : language
  37.                         }
  38.  
  39.     preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
  40.  
  41.     remove_tags = [dict(name=['object','link','embed'])]
  42.     remove_attributes = ['height','width']
  43.  
  44.     feeds = [
  45.                (u'Najnovije Vijesti', u'http://www.alo.rs/rss/danasnje_vesti')
  46.               ,(u'Politika'         , u'http://www.alo.rs/rss/politika')
  47.               ,(u'Vesti'            , u'http://www.alo.rs/rss/vesti')
  48.               ,(u'Sport'            , u'http://www.alo.rs/rss/sport')
  49.               ,(u'Ljudi'            , u'http://www.alo.rs/rss/ljudi')
  50.               ,(u'Saveti'           , u'http://www.alo.rs/rss/saveti')
  51.             ]
  52.  
  53.     def preprocess_html(self, soup):
  54.         for item in soup.findAll(style=True):
  55.             del item['style']
  56.         return soup
  57.  
  58.     def print_version(self, url):
  59.         artl = url.rpartition('/')[0]
  60.         artid = artl.rpartition('/')[2]
  61.         return 'http://www.alo.rs/resources/templates/tools/print.php?id=' + artid
  62.  
  63.     def image_url_processor(self, baseurl, url):
  64.         return url.replace('alo.rs//','alo.rs/')
  65.  
  66.