mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
122 lines
4.8 KiB
Python
122 lines
4.8 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
__license__ = 'GPL v3'
|
|
__copyright__ = '04 December 2010, desUBIKado'
|
|
__author__ = 'desUBIKado'
|
|
__description__ = 'Daily newspaper from Aragon'
|
|
__version__ = 'v0.10'
|
|
__date__ = '09, September 2017'
|
|
'''
|
|
elperiodicodearagon.com
|
|
'''
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
|
|
class elperiodicodearagon(BasicNewsRecipe):
|
|
title = u'El Periodico de Aragon'
|
|
__author__ = u'desUBIKado'
|
|
description = u'Noticias desde Aragon'
|
|
publisher = u'elperiodicodearagon.com'
|
|
category = u'news, politics, Spain, Aragon'
|
|
oldest_article = 1
|
|
delay = 1
|
|
max_articles_per_feed = 100
|
|
no_stylesheets = True
|
|
use_embedded_content = False
|
|
language = 'es'
|
|
masthead_url = 'http://pdf.elperiodicodearagon.com/img/logotipo.gif'
|
|
encoding = 'iso-8859-1'
|
|
remove_empty_feeds = True
|
|
remove_javascript = True
|
|
|
|
feeds = [
|
|
(u'Portada', u'http://zetaestaticos.com/aragon/rss/portada_es.xml'),
|
|
(u'Arag\xf3n', u'http://zetaestaticos.com/aragon/rss/2_es.xml'),
|
|
(u'Internacional', u'http://zetaestaticos.com/aragon/rss/4_es.xml'),
|
|
(u'Espa\xf1a', u'http://zetaestaticos.com/aragon/rss/3_es.xml'),
|
|
(u'Econom\xeda', u'http://zetaestaticos.com/aragon/rss/5_es.xml'),
|
|
(u'Deportes', u'http://zetaestaticos.com/aragon/rss/7_es.xml'),
|
|
(u'Real Zaragoza', u'http://zetaestaticos.com/aragon/rss/10_es.xml'),
|
|
(u'Tecnyconta Zaragoza', u'http://zetaestaticos.com/aragon/rss/91_es.xml'),
|
|
(u'Monta\xf1ismo', u'http://zetaestaticos.com/aragon/rss/354_es.xml'),
|
|
(u'Opini\xf3n', u'http://zetaestaticos.com/aragon/rss/103_es.xml'),
|
|
(u'Tema del d\xeda', u'http://zetaestaticos.com/aragon/rss/102_es.xml'),
|
|
(u'Escenarios', u'http://zetaestaticos.com/aragon/rss/105_es.xml'),
|
|
(u'Sociedad', u'http://zetaestaticos.com/aragon/rss/104_es.xml'),
|
|
(u'Gente', u'http://zetaestaticos.com/aragon/rss/330_es.xml'),
|
|
(u'Espacio 3', u'http://zetaestaticos.com/aragon/rss/328_es.xml'),
|
|
(u'Fiestas del Pilar', u'http://zetaestaticos.com/aragon/rss/107_es.xml'),
|
|
(u'Semana Santa', u'http://zetaestaticos.com/aragon/rss/385_es.xml'), (
|
|
u'La crónica de Valdejal\xf3n',
|
|
u'http://zetaestaticos.com/aragon/rss/206_es.xml'
|
|
), (
|
|
u'La crónica de Campo de Borja',
|
|
u'http://zetaestaticos.com/aragon/rss/208_es.xml'
|
|
), (
|
|
u'La crónica de Ejea y sus pueblos',
|
|
u'http://zetaestaticos.com/aragon/rss/212_es.xml'
|
|
), (
|
|
u'La crónica del Bajo Gállego',
|
|
u'http://zetaestaticos.com/aragon/rss/205_es.xml'
|
|
), (
|
|
u'La crónica del Campo de Cariñena',
|
|
u'http://zetaestaticos.com/aragon/rss/207_es.xml'
|
|
), (
|
|
u'La crónica de la Ribera Alta del Ebro',
|
|
u'http://zetaestaticos.com/aragon/rss/211_es.xml'
|
|
), (
|
|
u'La crónica del Campo de Belchite',
|
|
u'http://zetaestaticos.com/aragon/rss/331_es.xml'
|
|
)
|
|
]
|
|
|
|
remove_tags_before = dict(name='div', attrs={'class': 'Pagina'})
|
|
remove_tags_after = dict(name='div', attrs={'class': 'ComentariosNew'})
|
|
|
|
keep_only_tags = [dict(name='div', attrs={'class': 'Pagina'})]
|
|
|
|
remove_tags = [
|
|
dict(
|
|
name='nav',
|
|
attrs={'class': ['Compartir', 'HerramientasConversacion Herramientas']}
|
|
),
|
|
dict(name='h5', attrs={'class': ['CintilloBox']}),
|
|
dict(
|
|
name='div',
|
|
attrs={
|
|
'class': [
|
|
'BoxMenu BoxMenuConFoto', 'BxGalerias', 'ConStick',
|
|
'HerramientasComentarioNew Herramientas', 'NumeroComentarioNew'
|
|
]
|
|
}
|
|
),
|
|
dict(
|
|
name='div',
|
|
attrs={
|
|
'class': [
|
|
'BoxPestanas', 'Box', 'ColumnaDerecha',
|
|
'NoticiasRelacionadasDeNoticia',
|
|
'CintilloNoticiasRelacionadasDeNoticia'
|
|
]
|
|
}
|
|
),
|
|
dict(name='a', attrs={'class': ['IrA BotonLink']})
|
|
]
|
|
|
|
# Recuperamos la portada de papel (la imagen format=1 tiene mayor resolucion)
|
|
|
|
def get_cover_url(self):
|
|
index = 'http://pdf.elperiodicodearagon.com/edicion.php'
|
|
soup = self.index_to_soup(index)
|
|
for image in soup.findAll('img', src=True):
|
|
if image['src'].startswith('/funciones/img-public.php?key='):
|
|
return 'http://pdf.elperiodicodearagon.com' + image['src']
|
|
return None
|
|
|
|
extra_css = '''
|
|
h1 {font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:28px;}
|
|
h2 {font-family:Arial,Helvetica,sans-serif; font-style:italic;font-size:14px;color:#4D4D4D;}
|
|
h3 {font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:18px;}
|
|
'''
|