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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = u'2010, Tomasz Dlugosz <tomek3d@gmail.com>'
  5. '''
  6. fronda.pl
  7. '''
  8.  
  9. from calibre.web.feeds.news import BasicNewsRecipe
  10. import re
  11.  
  12. class Fronda(BasicNewsRecipe):
  13.     title          = u'Fronda.pl'
  14.     publisher      = u'Fronda.pl'
  15.     description    = u'Portal po\u015bwi\u0119cony - Infformacje'
  16.     language = 'pl'
  17.     __author__ = u'Tomasz D\u0142ugosz'
  18.     oldest_article = 7
  19.     max_articles_per_feed = 100
  20.     use_embedded_content = False
  21.  
  22.     feeds          = [(u'Infformacje', u'http://fronda.pl/news/feed')]
  23.  
  24.     keep_only_tags = [dict(name='h2', attrs={'class':'news_title'}),
  25.                       dict(name='div', attrs={'class':'naglowek_tresc'}),
  26.                       dict(name='div', attrs={'id':'czytaj'}) ]
  27.  
  28.     remove_tags = [dict(name='a', attrs={'class':'print'})]
  29.  
  30.     preprocess_regexps = [
  31.         (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in 
  32.             [ (r'<p><a href="http://fronda.pl/sklepy">.*</a></p>', lambda match: ''),
  33.               (r'<p><a href="http://fronda.pl/pasaz">.*</a></p>', lambda match: ''),
  34.               (r'<h3><strong>W.* lektury.*</a></p></div>', lambda match: '</div>'),
  35.               (r'<h3>Zobacz t.*?</div>', lambda match: '</div>'),
  36.               (r'<p[^>]*> </p>', lambda match: ''),
  37.               (r'<p><span style=".*?"><br /></span></p> ', lambda match: ''),
  38.               (r'<a style=\'float:right;margin-top:3px;\' href="http://www.facebook.com/share.php?.*?</a>', lambda match: '')]
  39.     ]
  40.