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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2009-2010, Darko Miletic <darko.miletic at gmail.com>'
  3.  
  4. '''
  5. e-novine.com
  6. '''
  7.  
  8. import re
  9. from calibre.web.feeds.news import BasicNewsRecipe
  10.  
  11. class E_novine(BasicNewsRecipe):
  12.     title                 = 'E-Novine'
  13.     __author__            = 'Darko Miletic'
  14.     description           = 'News from Serbia'
  15.     publisher             = 'E-novine'
  16.     category              = 'news, politics, Balcans'
  17.     oldest_article        = 2
  18.     max_articles_per_feed = 100
  19.     no_stylesheets        = True
  20.     encoding              = 'utf-8'
  21.     use_embedded_content  = False
  22.     language              = 'sr'
  23.     publication_type      = 'newsportal'    
  24.     masthead_url          = 'http://www.e-novine.com/themes/e_novine/img/logo.gif'
  25.     extra_css = ' @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} .article_description,body{font-family: Arial,Helvetica,sans1,sans-serif} img{float: none; margin-bottom: 0.8em} '
  26.  
  27.     conversion_options = {
  28.                           'comment'          : description
  29.                         , 'tags'             : category
  30.                         , 'publisher'        : publisher
  31.                         , 'language'         : language
  32.                         }
  33.  
  34.     preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
  35.  
  36.     keep_only_tags = [
  37.                          dict(name='div', attrs={'class':'article_head'})
  38.                         ,dict(name='div', attrs={'id':'article_body'})
  39.                      ]
  40.  
  41.     remove_tags = [
  42.                      dict(name=['object','link','embed','iframe'])
  43.                     ,dict(attrs={'id':'box_article_tools'})
  44.                   ]
  45.     remove_attributes = ['height','width','lang']
  46.  
  47.     feeds = [(u'Sve vesti', u'http://www.e-novine.com/feed/index.1.rss' )]
  48.  
  49.     def preprocess_html(self, soup):
  50.         for item in soup.findAll(style=True):
  51.             del item['style']
  52.         return self.adeify_images(soup)
  53.  
  54.     def print_version(self, url):
  55.         return url + '?print'
  56.