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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2009, Mathieu Godlewski <mathieu at godlewski.fr>'
  5. '''
  6. Courrier International
  7. '''
  8.  
  9. import re
  10. from calibre.web.feeds.news import BasicNewsRecipe
  11.  
  12. class CourrierInternational(BasicNewsRecipe):
  13.     title          = 'Courrier International'
  14.     __author__ = 'Mathieu Godlewski <mathieu at godlewski.fr>'
  15.     description = 'Global news in french from international newspapers'
  16.     oldest_article = 7
  17.     language = 'fr'
  18.  
  19.     max_articles_per_feed = 50
  20.     no_stylesheets = True
  21.  
  22.     html2lrf_options = ['--base-font-size', '10']
  23.  
  24.     feeds =  [
  25.         # Some articles requiring subscription fails on download.
  26.         ('A la Une', 'http://www.courrierinternational.com/rss/rss_a_la_une.xml'),
  27.     ]
  28.  
  29.     preprocess_regexps = [ (re.compile(i[0], re.IGNORECASE|re.DOTALL), i[1]) for i in
  30.         [
  31.             #Handle Depeches
  32.             (r'.*<td [^>]*>([0-9][0-9]/.*</p>)</td>.*', lambda match : '<html><body><table><tr><td>'+match.group(1)+'</td></tr></table></body></html>'),
  33.             #Handle Articles
  34.             (r'.*<td [^>]*>(Courrier international.*?)                            <td width="10"><img src="/img/espaceur.gif"></td>.*', lambda match : '<html><body><table><tr><td>'+match.group(1)+'</body></html>'),
  35.         ]
  36.     ]
  37.  
  38.  
  39.     def print_version(self, url):
  40.         return re.sub('/[a-zA-Z]+\.asp','/imprimer.asp' ,url)
  41.  
  42.