| 1 |
# -*- coding: utf-8 -*- |
| 2 |
__license__ = 'GPL v3' |
| 3 |
__copyright__ = '2011 Aurélien Chabot <[email protected]>' |
| 4 |
''' |
| 5 |
LePoint.fr |
| 6 |
''' |
| 7 |
from calibre.web.feeds.recipes import BasicNewsRecipe |
| 8 |
|
| 9 |
|
| 10 |
class lepoint(BasicNewsRecipe): |
| 11 |
title = 'Le Point' |
| 12 |
__author__ = 'calibre' |
| 13 |
description = 'Actualités' |
| 14 |
encoding = 'utf-8' |
| 15 |
publisher = 'LePoint.fr' |
| 16 |
category = 'news, France, world' |
| 17 |
language = 'fr' |
| 18 |
|
| 19 |
use_embedded_content = False |
| 20 |
timefmt = ' [%d %b %Y]' |
| 21 |
max_articles_per_feed = 15 |
| 22 |
no_stylesheets = True |
| 23 |
remove_empty_feeds = True |
| 24 |
filterDuplicates = True |
| 25 |
|
| 26 |
extra_css = ''' |
| 27 |
h1 {font-size:xx-large; font-family:Arial,Helvetica,sans-serif;} |
| 28 |
.chapo {font-size:xx-small; font-family:Arial,Helvetica,sans-serif;} |
| 29 |
.info_article {font-size:xx-small; color:#4D4D4D; font-family:Arial,Helvetica,sans-serif;} |
| 30 |
.media_article {font-size:xx-small; color:#4D4D4D; font-family:Arial,Helvetica,sans-serif;} |
| 31 |
.article {font-size:medium; font-family:Arial,Helvetica,sans-serif;} |
| 32 |
''' |
| 33 |
|
| 34 |
remove_tags = [ |
| 35 |
dict(name='iframe'), |
| 36 |
dict(name='div', attrs={'class': ['entete_chroniqueur']}), |
| 37 |
dict(name='div', attrs={'class': ['col_article']}), |
| 38 |
dict(name='div', attrs={'class': ['signature_article']}), |
| 39 |
dict(name='div', attrs={'class': ['util_font util_article']}), |
| 40 |
dict(name='div', attrs={'class': ['util_article bottom']}), |
| 41 |
] |
| 42 |
|
| 43 |
keep_only_tags = [dict(name='div', attrs={'class': ['page_article']})] |
| 44 |
|
| 45 |
remove_tags_after = dict(name='div', attrs={'class': ['util_article bottom']}) |
| 46 |
|
| 47 |
feeds = [ |
| 48 |
('À la une', 'http://www.lepoint.fr/rss.xml'), |
| 49 |
('International', 'http://www.lepoint.fr/monde/rss.xml'), |
| 50 |
('Tech/Web', 'http://www.lepoint.fr/high-tech-internet/rss.xml'), |
| 51 |
('Sciences', 'http://www.lepoint.fr/science/rss.xml'), |
| 52 |
('Economie', 'http://www.lepoint.fr/economie/rss.xml'), |
| 53 |
('Socièté', 'http://www.lepoint.fr/societe/rss.xml'), |
| 54 |
('Politique', 'http://www.lepoint.fr/politique/rss.xml'), |
| 55 |
('Médias', 'http://www.lepoint.fr/medias/rss.xml'), |
| 56 |
('Culture', 'http://www.lepoint.fr/culture/rss.xml'), |
| 57 |
('Santé', 'http://www.lepoint.fr/sante/rss.xml'), |
| 58 |
('Sport', 'http://www.lepoint.fr/sport/rss.xml'), |
| 59 |
] |
| 60 |
|
| 61 |
def preprocess_html(self, soup): |
| 62 |
for item in soup.findAll(style=True): |
| 63 |
del item['style'] |
| 64 |
return soup |
| 65 |
|
| 66 |
def get_masthead_url(self): |
| 67 |
masthead = 'http://www.lepoint.fr/images/commun/logo.png' |
| 68 |
br = BasicNewsRecipe.get_browser(self) |
| 69 |
try: |
| 70 |
br.open(masthead) |
| 71 |
except Exception: |
| 72 |
self.log('\nCover unavailable') |
| 73 |
masthead = None |
| 74 |
return masthead |