home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_4373 < prev    next >
Encoding:
Text File  |  2010-09-30  |  1.7 KB  |  52 lines

  1. # -*- coding: utf-8 -*-
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2009, Gerhard Aigner <gerhard.aigner at gmail.com>'
  5.  
  6. ''' http://www.derstandard.at - Austrian Newspaper '''
  7. import re
  8. from calibre.web.feeds.news import BasicNewsRecipe
  9.  
  10. class TelepolisNews(BasicNewsRecipe):
  11.     title          = u'Telepolis (News)'
  12.     __author__ = 'Gerhard Aigner'
  13.     publisher = 'Heise Zeitschriften Verlag GmbH & Co KG'
  14.     description = 'News from telepolis'
  15.     category = 'news'
  16.     oldest_article = 7
  17.     max_articles_per_feed = 100
  18.     recursion = 0
  19.     no_stylesheets = True
  20.     encoding = "utf-8"
  21.     language = 'de_AT'
  22.  
  23.     use_embedded_content = False
  24.     remove_empty_feeds = True
  25.  
  26.     preprocess_regexps = [(re.compile(r'<a[^>]*>', re.DOTALL|re.IGNORECASE), lambda match: ''),
  27.         (re.compile(r'</a>', re.DOTALL|re.IGNORECASE), lambda match: ''),]
  28.  
  29.     keep_only_tags = [dict(name = 'table',attrs={'class':'blogtable'})]
  30.     remove_tags = [dict(name='img'), dict(name='td',attrs={'class':'blogbottom'})]
  31.  
  32.     feeds          = [(u'News', u'http://www.heise.de/tp/news.rdf')]
  33.  
  34.     html2lrf_options = [
  35.         '--comment'  , description
  36.         , '--category' , category
  37.         , '--publisher', publisher
  38.     ]
  39.  
  40.     html2epub_options  = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
  41.  
  42.     def get_article_url(self, article):
  43.         '''if the linked article is of kind artikel don't take it'''
  44.         if (article.link.count('artikel') > 0) :
  45.             return None
  46.         return article.link
  47.  
  48.     def preprocess_html(self, soup):
  49.         mtag = '<meta http-equiv="Content-Type" content="text/html; charset=' + self.encoding + '">'
  50.         soup.head.insert(0,mtag)
  51.         return soup
  52.