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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2008-2011, Lionel Bergeret <lbergeret at gmail.com>'
  5. '''
  6. lavenir.net
  7. '''
  8.  
  9. from calibre.web.feeds.news import BasicNewsRecipe
  10.  
  11. class LAvenir(BasicNewsRecipe):
  12.     title                 = u'L\'Avenir'
  13.     __author__            = u'Lionel Bergeret'
  14.     description           = u'News from Belgium in French'
  15.     publisher             = u'lavenir.net'
  16.     category              = 'news, Belgium'
  17.     oldest_article        = 3
  18.     language              = 'fr'
  19.  
  20.     max_articles_per_feed = 20
  21.     no_stylesheets        = True
  22.     use_embedded_content  = False
  23.     timefmt               = ' [%d %b %Y]'
  24.  
  25.     keep_only_tags = [
  26.        dict(name = 'div', attrs = {'class': 'photo'})
  27.       ,dict(name = 'p', attrs = {'class': 'intro'})
  28.       ,dict(name = 'div', attrs = {'class': 'article-body'})
  29.     ]
  30.  
  31.     feeds = [
  32.          (u'Belgique'       , u'http://www.lavenir.net/rss.aspx?foto=1&intro=1§ion=info&info=df156511-c24f-4f21-81c3-a5d439a9cf4b' )
  33.         ,(u'Monde'          , u'http://www.lavenir.net/rss.aspx?foto=1&intro=1§ion=info&info=1642237c-66b9-4e8a-a8c1-288d61fefe7e' )
  34.         ,(u'Societe'        , u'http://www.lavenir.net/rss.aspx?foto=1&intro=1§ion=info&info=12e1a2f4-7e03-4cf1-afec-016869072317' )
  35.     ]
  36.  
  37.     def preprocess_html(self, soup):
  38.         for alink in soup.findAll('a'):
  39.             if alink.string is not None:
  40.                tstr = alink.string
  41.                alink.replaceWith(tstr)
  42.         return soup
  43.  
  44.     def get_cover_url(self):
  45.         cover_url = 'http://www.lavenir.net/extra/Static/journal/Pdf/1/UNE_Nationale.PDF'
  46.         return cover_url
  47.