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

  1. # -*- coding: utf-8 -*-
  2.  
  3.  
  4. __license__   = 'GPL v3'
  5. __copyright__ = '2009, Gerhard Aigner <gerhard.aigner at gmail.com>'
  6.  
  7. ''' http://www.diepresse.at - Austrian Newspaper '''
  8.  
  9. import re
  10. from calibre.web.feeds.news import BasicNewsRecipe
  11.  
  12. class DiePresseRecipe(BasicNewsRecipe):
  13.     title = u'diePresse'
  14.     __author__ = 'Gerhard Aigner'
  15.     description = u'DiePresse.com - Die Online-Ausgabe der ├ûsterreichischen Tageszeitung Die Presse.' 
  16.     publisher ='DiePresse.com'
  17.     category = 'news, politics, nachrichten, Austria'
  18.     use_embedded_content = False
  19.     remove_empty_feeds = True
  20.     lang = 'de-AT'
  21.     no_stylesheets = True
  22.     encoding = 'ISO-8859-1'
  23.     language = 'de'
  24.  
  25.     recursions = 0
  26.     oldest_article = 1
  27.     max_articles_per_feed = 100
  28.   
  29.     html2lrf_options = [
  30.                           '--comment'  , description
  31.                         , '--category' , category
  32.                         , '--publisher', publisher
  33.                         ]
  34.  
  35.     html2epub_options  = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' 
  36.   
  37.     preprocess_regexps = [
  38.     (re.compile(r'Textversion', re.DOTALL), lambda match: ''),
  39.     ]
  40.     
  41.     remove_tags = [dict(name='hr'),
  42.     dict(name='br'),
  43.     dict(name='small'),
  44.     dict(name='img'),
  45.     dict(name='div', attrs={'class':'textnavi'}),
  46.     dict(name='h1', attrs={'class':'titel'}),
  47.     dict(name='a', attrs={'class':'print'}),
  48.     dict(name='div', attrs={'class':'hline'})]
  49.     
  50.     feeds = [(u'Politik', u'http://diepresse.com/rss/Politik'),
  51.     (u'Wirtschaft', u'http://diepresse.com/rss/Wirtschaft'),
  52.     (u'Europa', u'http://diepresse.com/rss/EU'),
  53.     (u'Panorama', u'http://diepresse.com/rss/Panorama'),
  54.     (u'Sport', u'http://diepresse.com/rss/Sport'),
  55.     (u'Kultur', u'http://diepresse.com/rss/Kultur'),
  56.     (u'Leben', u'http://diepresse.com/rss/Leben'),
  57.     (u'Tech', u'http://diepresse.com/rss/Tech'),
  58.     (u'Wissenschaft', u'http://diepresse.com/rss/Science'),
  59.     (u'Bildung', u'http://diepresse.com/rss/Bildung'),
  60.     (u'Gesundheit', u'http://diepresse.com/rss/Gesundheit'),
  61.     (u'Recht', u'http://diepresse.com/rss/Recht'),
  62.     (u'Spectrum', u'http://diepresse.com/rss/Spectrum'),
  63.     (u'Meinung', u'http://diepresse.com/rss/Meinung')]
  64.  
  65.     def print_version(self, url):
  66.         return url.replace('home','text/home')
  67.  
  68.     def preprocess_html(self, soup):
  69.         soup.html['xml:lang'] = self.lang
  70.         soup.html['lang']     = self.lang
  71.     mtag = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
  72.         soup.head.insert(0,mtag)
  73.     return soup