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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2008-2011, Lionel Bergeret <lbergeret at gmail.com>'
  5. '''
  6. lalibre.be
  7. '''
  8.  
  9. from calibre import strftime
  10. from calibre.web.feeds.news import BasicNewsRecipe
  11.  
  12. class LaLibre(BasicNewsRecipe):
  13.     title                 = u'La Libre Belgique'
  14.     __author__            = u'Lionel Bergeret'
  15.     description           = u'News from Belgium in French'
  16.     publisher             = u'lalibre.be'
  17.     category              = 'news, Belgium'
  18.     oldest_article        = 3
  19.     language              = 'fr'
  20.     masthead_url          = 'http://www.lalibre.be/img/logoLaLibre.gif'
  21.  
  22.     max_articles_per_feed = 20
  23.     no_stylesheets        = True
  24.     use_embedded_content  = False
  25.     timefmt               = ' [%d %b %Y]'
  26.  
  27.     remove_tags_before = dict(name = 'div', attrs = {'class': 'extraMainContent'})
  28.     remove_tags_after  = dict(name = 'div', attrs = {'id': 'articleText'})
  29.  
  30.     remove_tags = [dict(name = 'div', attrs = {'id': 'strongArticleLinks'})]
  31.  
  32.     feeds = [
  33.          (u'L\'actu'           , u'http://www.lalibre.be/rss/?section=10' )
  34.         ,(u'Culture'           , u'http://www.lalibre.be/rss/?section=5' )
  35.         ,(u'Economie'          , u'http://www.lalibre.be/rss/?section=3' )
  36.         ,(u'Libre Entreprise'  , u'http://www.lalibre.be/rss/?section=904' )
  37.         ,(u'Sports'            , u'http://www.lalibre.be/rss/?section=2' )
  38.         ,(u'Societe'           , u'http://www.lalibre.be/rss/?section=12' )
  39.     ]
  40.  
  41.     def preprocess_html(self, soup):
  42.         for alink in soup.findAll('a'):
  43.             if alink.string is not None:
  44.                tstr = alink.string
  45.                alink.replaceWith(tstr)
  46.         return soup
  47.  
  48.     def get_cover_url(self):
  49.         cover_url = strftime('http://pdf-online.lalibre.be/pdfonline/image/%Y%m%d/llb_%Y%m%d_nam_libre_001.pdf.L.jpg')
  50.         return cover_url
  51.