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

  1. import re
  2. from calibre.web.feeds.news import BasicNewsRecipe
  3.  
  4. class KANewsRecipe(BasicNewsRecipe):
  5.     title = u'KA-News.de'
  6.     description = u'Nachrichten aus Karlsruhe, Deutschland und der Welt.'
  7.     __author__ = 'tfeld'
  8.     lang='de'
  9.     language = 'de'
  10.     no_stylesheets = True
  11.  
  12.     oldest_article = 7
  13.     max_articles_per_feed = 100
  14.  
  15.     feeds = [
  16.                 (u'News aus Karlsruhe', 'http://www.ka-news.de/storage/rss/rss/karlsruhe.xml'),
  17.                 (u'Kulturnachrichten aus Karlsruhe', 'http://www.ka-news.de/storage/rss/rss/kultur.xml'),
  18.                 (u'Durlach: News aus Durlach', 'http://www.ka-news.de/storage/rss/rss/durlach.xml'),
  19.                 (u'Stutensee: News aus Stutensee Blankenloch, B├╝chig, Friedrichstal, Staffort, Sp├╢ck', 'http://www.ka-news.de/storage/rss/rss/stutensee.xml'),
  20.                 (u'Bruchsal: News aus Bruchsal', 'http://www.ka-news.de/storage/rss/rss/bruchsal.xml'),
  21.                 (u'Wirtschaftsnews aus Karlsruhe', 'http://www.ka-news.de/storage/rss/rss/wirtschaft.xml'),
  22.                 (u'ka-news.de - Sport', 'http://www.ka-news.de/storage/rss/rss/sport.xml'),
  23.                 (u'KSC-News - News rund um den KSC', 'http://www.ka-news.de/storage/rss/rss/ksc.xml'),
  24.                 (u'ka-news.de - BG Karlsruhe', 'http://www.ka-news.de/storage/rss/rss/basketball.xml')
  25.             ]
  26.  
  27.     preprocess_regexps = [
  28.         (re.compile(r'width:[0-9]*?px', re.DOTALL|re.IGNORECASE), lambda match: ''),
  29.     ]
  30.  
  31.     remove_tags_before = dict(id='artdetail_ueberschrift')
  32.     remove_tags_after = dict(id='artdetail_unterzeile')
  33.     remove_tags = [dict(name=['div'], attrs={'class': 'lbx_table'}),
  34.          dict(name=['div'], attrs={'class': 'lk_zumthema'}),
  35.          dict(name=['div'], attrs={'class': 'lk_thumb'}),
  36.          dict(name=['div'], attrs={'class': 'lk_trenner'}),
  37.          dict(name=['div'], attrs={'class': 'lupen_container'}),
  38.          dict(name=['script']),
  39.          dict(name=['span'], attrs={'style': 'display:none;'}),
  40.          dict(name=['span'], attrs={'class': 'comm_info'}),
  41.          dict(name=['h3'], attrs={'id': 'artdetail_unterzeile'})]
  42.  
  43.     # removing style attribute _after_ removing specifig tags above
  44.     remove_attributes = ['width','height','style']
  45.  
  46.     extra_css = '''
  47.          h1{ font-size:large; font-weight:bold;  }
  48.          h2{ font-size:medium; font-weight:bold; }
  49.     '''
  50.  
  51.     def get_cover_url(self):
  52.         return 'http://www.ka-news.de/storage/scl/techkanews/logos/434447_m1t1w250q75s1v29681_ka-news-Logo_mit_Schatten_transparent.png'
  53.  
  54.