home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_3747 < prev    next >
Encoding:
Text File  |  2010-07-08  |  1.9 KB  |  53 lines

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. evz.ro
  5. '''
  6.  
  7. import re
  8. from calibre.web.feeds.news import BasicNewsRecipe
  9.  
  10. class EVZ_Ro(BasicNewsRecipe):
  11.     title                 = 'evz.ro'
  12.     __author__            = 'Darko Miletic'
  13.     description           = 'News from Romania'
  14.     publisher             = 'evz.ro'
  15.     category              = 'news, politics, Romania'
  16.     oldest_article        = 2
  17.     max_articles_per_feed = 200
  18.     no_stylesheets        = True
  19.     encoding              = 'utf8'
  20.     use_embedded_content  = False
  21.     language              = 'ro'
  22.     masthead_url          = 'http://www.evz.ro/fileadmin/images/logo.gif'
  23.     extra_css             = ' body{font-family: Georgia,Arial,Helvetica,sans-serif } .firstP{font-size: 1.125em} .author,.articleInfo{font-size: small} '
  24.  
  25.     conversion_options = {
  26.                           'comment'   : description
  27.                         , 'tags'      : category
  28.                         , 'publisher' : publisher
  29.                         , 'language'  : language
  30.                         }
  31.  
  32.     preprocess_regexps = [
  33.          (re.compile(r'<head>.*?<title>', re.DOTALL|re.IGNORECASE),lambda match: '<head><title>')
  34.         ,(re.compile(r'</title>.*?</head>', re.DOTALL|re.IGNORECASE),lambda match: '</title></head>')
  35.     ]
  36.  
  37.     remove_tags       = [
  38.                           dict(name=['form','embed','iframe','object','base','link','script','noscript'])
  39.                          ,dict(attrs={'class':['section','statsInfo','email il']})
  40.                          ,dict(attrs={'id'   :'gallery'})
  41.                         ]
  42.  
  43.     remove_tags_after = dict(attrs={'class':'section'})
  44.     keep_only_tags    = [dict(attrs={'class':'single'})]
  45.     remove_attributes = ['height','width']
  46.  
  47.     feeds = [(u'Articles', u'http://www.evz.ro/rss.xml')]
  48.  
  49.     def preprocess_html(self, soup):
  50.         for item in soup.findAll(style=True):
  51.             del item['style']
  52.         return soup
  53.