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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2008-2011, Lionel Bergeret <lbergeret at gmail.com>'
  5. '''
  6. dhnet.be
  7. '''
  8.  
  9. from calibre import strftime
  10. from calibre.web.feeds.news import BasicNewsRecipe
  11.  
  12. class DHNetBe(BasicNewsRecipe):
  13.     title                 = u'La Derniere Heure'
  14.     __author__            = u'Lionel Bergeret'
  15.     description           = u'News from Belgium in French'
  16.     publisher             = u'dhnet.be'
  17.     category              = 'news, Belgium'
  18.     oldest_article        = 3
  19.     language              = 'fr'
  20.     masthead_url          = 'http://www.dhnet.be/images/homepage_logo_dh.gif'
  21.  
  22.     max_articles_per_feed = 20
  23.     no_stylesheets        = True
  24.     use_embedded_content  = False
  25.     timefmt               = ' [%d %b %Y]'
  26.  
  27.     keep_only_tags = [
  28.        dict(name = 'div', attrs = {'id': 'articleText'})
  29.       ,dict(name = 'div', attrs = {'id': 'articlePicureAndLinks'})
  30.     ]
  31.  
  32.     feeds = [
  33.          (u'La Une'         , u'http://www.dhnet.be/rss' )
  34.         ,(u'La Une Sports'  , u'http://www.dhnet.be/rss/dhsports/' )
  35.         ,(u'La Une Info'    , u'http://www.dhnet.be/rss/dhinfos/' )
  36.     ]
  37.  
  38.     def preprocess_html(self, soup):
  39.         for alink in soup.findAll('a'):
  40.             if alink.string is not None:
  41.                tstr = alink.string
  42.                alink.replaceWith(tstr)
  43.         return soup
  44.  
  45.     def get_cover_url(self):
  46.         cover_url = strftime('http://pdf-online.dhnet.be/pdfonline/image/%Y%m%d/dh_%Y%m%d_nam_infoge_001.pdf.L.jpg')
  47.         return cover_url
  48.