mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add lexpress news website recipe
This commit is contained in:
parent
7f091a5ffe
commit
fcdfe4a44a
73
recipes/lexpress.recipe
Normal file
73
recipes/lexpress.recipe
Normal file
@ -0,0 +1,73 @@
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2011 Aurélien Chabot <contact@aurelienchabot.fr>'
|
||||
'''
|
||||
Lexpress.fr
|
||||
'''
|
||||
import re
|
||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||
|
||||
class lepoint(BasicNewsRecipe):
|
||||
|
||||
title = 'L\'express'
|
||||
__author__ = 'calibre'
|
||||
description = 'Actualités'
|
||||
encoding = 'cp1252'
|
||||
publisher = 'LExpress.fr'
|
||||
category = 'Actualité, France, Monde'
|
||||
language = 'fr'
|
||||
|
||||
use_embedded_content = False
|
||||
timefmt = ' [%d %b %Y]'
|
||||
max_articles_per_feed = 15
|
||||
no_stylesheets = True
|
||||
remove_empty_feeds = True
|
||||
filterDuplicates = True
|
||||
|
||||
extra_css = '''
|
||||
h1 {font-size:xx-large; font-family:Arial,Helvetica,sans-serif;}
|
||||
.current_parent, p.heure, .ouverture {font-size:xx-small; color:#4D4D4D; font-family:Arial,Helvetica,sans-serif;}
|
||||
#contenu-article {font-size:medium; font-family:Arial,Helvetica,sans-serif;}
|
||||
.entete { font-weiht:bold;}
|
||||
'''
|
||||
|
||||
remove_tags = [
|
||||
dict(name='iframe'),
|
||||
dict(name='div', attrs={'class':['barre-outil-fb']}),
|
||||
dict(name='div', attrs={'class':['barre-outils']}),
|
||||
dict(id='bloc-sommaire'),
|
||||
dict(id='footer-article')
|
||||
]
|
||||
|
||||
keep_only_tags = [dict(name='div', attrs={'class':['bloc-article']})]
|
||||
|
||||
remove_tags_after = dict(id='content-article')
|
||||
|
||||
feeds = [
|
||||
(u'À la une', 'http://www.lexpress.fr/rss/alaune.xml'),
|
||||
('International', 'http://www.lexpress.fr/rss/monde.xml'),
|
||||
('Tech/Web', 'http://www.lexpress.fr/rss/high-tech.xml'),
|
||||
(u'Sciences/Santé', 'http://www.lexpress.fr/rss/science-et-sante.xml'),
|
||||
(u'Envronnement', 'http://www.lexpress.fr/rss/environnement.xml'),
|
||||
('Economie', 'http://www.lepoint.fr/economie/rss.xml'),
|
||||
(u'Socièté', 'http://www.lexpress.fr/rss/societe.xml'),
|
||||
('Politique', 'http://www.lexpress.fr/rss/politique.xml'),
|
||||
(u'Médias', 'http://www.lexpress.fr/rss/medias.xml'),
|
||||
('Culture', 'http://www.lexpress.fr/rss/culture.xml'),
|
||||
('Sport', 'http://www.lexpress.fr/rss/sport.xml')
|
||||
]
|
||||
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
for item in soup.findAll(style=True):
|
||||
del item['style']
|
||||
return soup
|
||||
|
||||
def get_masthead_url(self):
|
||||
masthead = 'http://static.lexpress.fr/imgstat/logo_lexpress.gif'
|
||||
br = BasicNewsRecipe.get_browser()
|
||||
try:
|
||||
br.open(masthead)
|
||||
except:
|
||||
self.log("\nCover unavailable")
|
||||
masthead = None
|
||||
return masthead
|
Loading…
x
Reference in New Issue
Block a user