mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-09-29 15:31:08 -04:00
91 lines
4.3 KiB
Plaintext
91 lines
4.3 KiB
Plaintext
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
|
__license__ = 'GPL v3'
|
|
__copyright__ = '2010-2014, Darko Miletic <darko.miletic at gmail.com>'
|
|
'''
|
|
elpais.com
|
|
'''
|
|
|
|
from calibre import strftime
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
|
|
class ElPais_RSS(BasicNewsRecipe):
|
|
title = u'El País'
|
|
__author__ = 'Darko Miletic'
|
|
description = u'Noticias de última hora sobre la actualidad en España y el mundo: política, economía, deportes, cultura, sociedad, tecnología, gente, opinión, viajes, moda, televisión, los blogs y las firmas de EL PAÍS. Además especiales, vídeos, fotos, audios, gráficos, entrevistas, promociones y todos los servicios de EL PAÍS.' # noqa
|
|
publisher = 'EDICIONES EL PAIS, S.L.'
|
|
category = 'news, politics, finances, world, spain'
|
|
oldest_article = 2
|
|
max_articles_per_feed = 200
|
|
no_stylesheets = True
|
|
encoding = 'utf8'
|
|
use_embedded_content = False
|
|
language = 'es'
|
|
remove_empty_feeds = True
|
|
publication_type = 'newspaper'
|
|
masthead_url = 'http://ep01.epimg.net/iconos/v1.x/v1.0/logos/cabecera_portada.png'
|
|
cover_url = strftime(
|
|
'http://srv00.epimg.net/pdf/elpais/1aPagina/%Y/%m/ep-%Y%m%d.pdf')
|
|
extra_css = """
|
|
h1{font-family: Georgia,"Times New Roman",Times,serif }
|
|
#subtitulo_noticia, .firma, .figcaption{font-size: small}
|
|
body{font-family: Arial,Helvetica,Garuda,sans-serif}
|
|
img{margin-bottom: 0.4em; display:block}
|
|
"""
|
|
|
|
conversion_options = {
|
|
'comment': description, 'tags': category, 'publisher': publisher, 'language': language
|
|
}
|
|
|
|
keep_only_tags = [
|
|
dict(attrs={'id': ['titulo_noticia', 'subtitulo_noticia']}), dict(
|
|
attrs={'class': ['firma', 'columna_texto', 'entrevista_p_r']})
|
|
]
|
|
remove_tags = [
|
|
dict(name=['iframe', 'embed', 'object']), dict(
|
|
attrs={'class': 'disposicion_vertical'})
|
|
]
|
|
|
|
feeds = [
|
|
|
|
(u'Lo ultimo', u'http://ep00.epimg.net/rss/tags/ultimas_noticias.xml'),
|
|
(u'America Latina', u'http://elpais.com/tag/rss/latinoamerica/a/'),
|
|
(u'Mexico', u'http://elpais.com/tag/rss/mexico/a/'),
|
|
(u'Europa', u'http://elpais.com/tag/rss/europa/a/'),
|
|
(u'Estados Unidos', u'http://elpais.com/tag/rss/estados_unidos/a/'),
|
|
(u'Oriente proximo', u'http://elpais.com/tag/rss/oriente_proximo/a/'),
|
|
(u'Andalucia', u'http://ep00.epimg.net/rss/ccaa/andalucia.xml'),
|
|
(u'Catalunia', u'http://ep00.epimg.net/rss/ccaa/catalunya.xml'),
|
|
(u'Comunidad Valenciana', u'http://ep00.epimg.net/rss/ccaa/valencia.xml'),
|
|
(u'Madrid', u'http://ep00.epimg.net/rss/ccaa/madrid.xml'),
|
|
(u'Pais Vasco', u'http://ep00.epimg.net/rss/ccaa/paisvasco.xml'),
|
|
(u'Galicia', u'http://ep00.epimg.net/rss/ccaa/galicia.xml'),
|
|
(u'Sociedad', u'http://ep00.epimg.net/rss/sociedad/portada.xml'),
|
|
(u'Deportes', u'http://ep00.epimg.net/rss/deportes/portada.xml'),
|
|
(u'Cultura', u'http://ep00.epimg.net/rss/cultura/portada.xml'),
|
|
(u'Cine', u'http://elpais.com/tag/rss/cine/a/'),
|
|
(u'Economía', u'http://elpais.com/tag/rss/economia/a/'),
|
|
(u'Literatura', u'http://elpais.com/tag/rss/libros/a/'),
|
|
(u'Musica', u'http://elpais.com/tag/rss/musica/a/'),
|
|
(u'Arte', u'http://elpais.com/tag/rss/arte/a/'),
|
|
(u'Medio Ambiente', u'http://elpais.com/tag/rss/medio_ambiente/a/'),
|
|
(u'Tecnologia', u'http://ep01.epimg.net/rss/tecnologia/portada.xml'),
|
|
(u'Ciencia', u'http://ep00.epimg.net/rss/tags/c_ciencia.xml'),
|
|
(u'Salud', u'http://elpais.com/tag/rss/salud/a/'),
|
|
(u'Ocio', u'http://elpais.com/tag/rss/ocio/a/'),
|
|
(u'Justicia y Leyes', u'http://elpais.com/tag/rss/justicia/a/'),
|
|
(u'Guerras y conflictos', u'http://elpais.com/tag/rss/conflictos/a/'),
|
|
(u'Politica', u'http://ep00.epimg.net/rss/politica/portada.xml'),
|
|
(u'Opinion', u'http://ep01.epimg.net/rss/elpais/opinion.xml')
|
|
]
|
|
|
|
def get_article_url(self, article):
|
|
url = BasicNewsRecipe.get_article_url(self, article)
|
|
if url and (not('/album/' in url) and not('/futbol/partido/' in url)):
|
|
return url
|
|
self.log('Skipping non-article', url)
|
|
return None
|
|
|
|
def preprocess_raw_html(self, raw, url):
|
|
return '<html><head><title>Untitled</title>' + raw[raw.find('</head>'):]
|