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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = u'2010, Tomasz Dlugosz <tomek3d@gmail.com>'
  5. '''
  6. rmf24.pl
  7. '''
  8.  
  9. import re
  10. from calibre.web.feeds.news import BasicNewsRecipe
  11.  
  12. class RMF24(BasicNewsRecipe):
  13.     title          = u'Rmf24.pl - Fakty'
  14.     description    = u'Fakty ze strony rmf24.pl'
  15.     language = 'pl'
  16.     oldest_article = 7
  17.     max_articles_per_feed = 100
  18.     __author__ = u'Tomasz D\u0142ugosz'
  19.     no_stylesheets = True
  20.     remove_javascript = True
  21.  
  22.     feeds          = [(u'Kraj', u'http://www.rmf24.pl/fakty/polska/feed'),
  23.                       (u'\u015awiat', u'http://www.rmf24.pl/fakty/swiat/feed')]
  24.  
  25.     keep_only_tags = [dict(name='div', attrs={'class':'box articleSingle print'})]
  26.  
  27.     remove_tags = [
  28.         dict(name='div', attrs={'id':'adBox625'}),
  29.         dict(name='div', attrs={'class':'toTop'}),
  30.         dict(name='div', attrs={'class':'category'}),
  31.         dict(name='div', attrs={'class':'REMOVE'}),
  32.         dict(name='div', attrs={'class':'embed embedAd'})]
  33.  
  34.     extra_css = '''
  35.         h1 { font-size: 1.2em; }
  36.         '''
  37.     preprocess_regexps = [
  38.         (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in
  39.         [
  40.             (r'<h2>Zdj.cie</h2>', lambda match: ''),
  41.             (r'embed embed(Left|Right|Center) articleEmbed(Audio|Wideo articleEmbedVideo|ArticleFull|ArticleTitle|ArticleListTitle|AlbumHorizontal)">', lambda match: 'REMOVE">'),
  42.             (r'<a href="http://www.facebook.com/pages/RMF24pl/.*?>RMF24.pl</a> on Facebook</div>', lambda match: '</div>')
  43.         ]
  44.     ]
  45.