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

  1. #!/usr/bin/env  python
  2.  
  3. __license__    = 'GPL v3'
  4. __author__ = 'Mori'
  5. __version__ = 'v. 0.5'
  6. '''
  7. di.com.pl
  8. '''
  9.  
  10. from calibre.web.feeds.news import BasicNewsRecipe
  11. import re
  12.  
  13. class DziennikInternautowRecipe(BasicNewsRecipe):
  14.     __author__ = 'Mori'
  15.     language = 'pl'
  16.  
  17.     title = u'Dziennik Internautow'
  18.     publisher = u'Dziennik Internaut\u00f3w Sp. z o.o.'
  19.     description = u'Internet w \u017cyciu i biznesie. Porady, wywiady, interwencje, bezpiecze\u0144stwo w Sieci, technologia.'
  20.  
  21.     max_articles_per_feed = 100
  22.     oldest_article = 7
  23.     cover_url = 'http://di.com.pl/pic/logo_di_norm.gif'
  24.     
  25.     no_stylesheets = True
  26.     remove_javascript = True
  27.     encoding = 'utf-8'
  28.     
  29.     extra_css = '''
  30.         .fotodesc{font-size: 75%;}
  31.         .pub_data{font-size: 75%;}
  32.         .fotonews{clear: both; padding-top: 10px; padding-bottom: 10px;}
  33.         #pub_foto{font-size: 75%; float: left; padding-right: 10px;}
  34.     '''
  35.     
  36.     feeds = [
  37.         (u'Dziennik Internaut\u00f3w', u'http://feeds.feedburner.com/glowny-di')
  38.     ]
  39.     
  40.     keep_only_tags = [
  41.         dict(name = 'div', attrs = {'id' : 'pub_head'}),
  42.         dict(name = 'div', attrs = {'id' : 'pub_content'})
  43.     ]
  44.     
  45.     remove_tags = [
  46.         dict(name = 'div', attrs = {'class' : 'poradniki_context'}),
  47.         dict(name = 'div', attrs = {'class' : 'uniBox'}),
  48.         dict(name = 'object', attrs = {}),
  49.         dict(name = 'h3', attrs = {})
  50.     ]
  51.     
  52.     preprocess_regexps = [
  53.         (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in 
  54.         [
  55.             (r', <a href="http://di.com.pl/komentarze,.*?</div>', lambda match: '</div>'),
  56.             (r'<div class="fotonews".*?">', lambda match: '<div class="fotonews">'),
  57.             (r'http://di.com.pl/pic/photo/mini/', lambda match: 'http://di.com.pl/pic/photo/oryginal/'),
  58.             (r'\s*</', lambda match: '</'),
  59.         ]
  60.     ]
  61.