Debian Codegraph @

recipes/dhnet_be.recipe

raw
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
13 class DHNetBe(BasicNewsRecipe):
14 title = 'La Derniere Heure'
15 __author__ = 'Lionel Bergeret'
16 description = 'News from Belgium in French'
17 publisher = 'dhnet.be'
18 category = 'news, Belgium'
19 oldest_article = 3
20 language = 'fr'
21 masthead_url = 'http://www.dhnet.be/images/homepage_logo_dh.gif'
22
23 max_articles_per_feed = 20
24 no_stylesheets = True
25 use_embedded_content = False
26 timefmt = ' [%d %b %Y]'
27
28 keep_only_tags = [dict(name='div', attrs={'id': 'articleText'}), dict(name='div', attrs={'id': 'articlePicureAndLinks'})]
29
30 feeds = [('La Une', 'http://www.dhnet.be/rss'), ('La Une Sports', 'http://www.dhnet.be/rss/dhsports/'), ('La Une Info', 'http://www.dhnet.be/rss/dhinfos/')]
31
32 def preprocess_html(self, soup):
33 for alink in soup.findAll('a'):
34 if alink.string is not None:
35 tstr = alink.string
36 alink.replaceWith(tstr)
37 return soup
38
39 def get_cover_url(self):
40 cover_url = strftime('http://pdf-online.dhnet.be/pdfonline/image/%Y%m%d/dh_%Y%m%d_nam_infoge_001.pdf.L.jpg')
41 return cover_url