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