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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
  5. '''
  6. www.hln.be
  7. '''
  8. from calibre.web.feeds.news import BasicNewsRecipe
  9. from calibre.ebooks.BeautifulSoup import Tag
  10.  
  11. class HLN_be(BasicNewsRecipe):
  12.     title                 = 'Het Belang Van Limburg'
  13.     __author__            = 'Darko Miletic and Sujata Raman'
  14.     description           = 'News from Belgium in Dutch'
  15.     publisher             = 'Het Belang Van Limburg'
  16.     category              = 'news, politics, Belgium'
  17.     oldest_article        = 2
  18.     max_articles_per_feed = 100
  19.     no_stylesheets        = True
  20.     use_embedded_content  = False
  21.     encoding              = 'utf-8'
  22.     language = 'nl_BE'
  23.  
  24.     lang                  = 'nl-BE'
  25.     direction             = 'ltr'
  26.  
  27.     html2lrf_options = [
  28.                           '--comment'  , description
  29.                         , '--category' , category
  30.                         , '--publisher', publisher
  31.                         ]
  32.  
  33.     html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\noverride_css=" p {text-indent: 0cm; margin-top: 0em; margin-bottom: 0.5em} "'
  34.  
  35.     extra_css = '''
  36.                     body{font-family:"Verdana",sans-serif; font-size:80%;}
  37.                     .h1{font-family:"Verdana",sans-serif; font-size:large; font-weight:bold;}
  38.                     .captionEmbeddedMasterObject{font-style:italic; font-size:80%;}
  39.                     .gen_footnote3{font-size:80%; color: #666666;}
  40.                 '''
  41.  
  42.  
  43.     keep_only_tags = [dict(name='div', attrs={'class':'art_box2'})]
  44.     remove_tags    = [
  45.                          dict(name=['embed','object'])
  46.                      ]
  47.  
  48.     feeds = [(u'Alle nieuws', u'http://www.hln.be/rss.xml')]
  49.  
  50.     def preprocess_html(self, soup):
  51.         del soup.body['onload']
  52.         for item in soup.findAll(style=True):
  53.             del item['style']
  54.         soup.html['lang']     = self.lang
  55.         soup.html['dir' ]     = self.direction
  56.         mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
  57.         mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
  58.         soup.head.insert(0,mlang)
  59.         soup.head.insert(1,mcharset)
  60.         return soup
  61.  
  62.