Update Heraldo de Aragon

This commit is contained in:
Kovid Goyal 2017-09-26 08:45:23 +05:30
parent fcae8b3e04
commit ebaa7b4ec3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -3,8 +3,8 @@ __license__ = 'GPL v3'
__copyright__ = '04 December 2010, desUBIKado' __copyright__ = '04 December 2010, desUBIKado'
__author__ = 'desUBIKado' __author__ = 'desUBIKado'
__description__ = 'Daily newspaper from Aragon' __description__ = 'Daily newspaper from Aragon'
__version__ = 'v0.07' __version__ = 'v0.08'
__date__ = '17, August 2014' __date__ = '10, September 2017'
''' '''
http://www.heraldo.es/ http://www.heraldo.es/
''' '''
@ -15,7 +15,7 @@ from calibre.web.feeds.news import BasicNewsRecipe
class heraldo(BasicNewsRecipe): class heraldo(BasicNewsRecipe):
__author__ = 'desUBIKado' author = 'desUBIKado'
description = 'Daily newspaper from Aragon' description = 'Daily newspaper from Aragon'
title = u'Heraldo de Aragon' title = u'Heraldo de Aragon'
publisher = 'Grupo Heraldo' publisher = 'Grupo Heraldo'
@ -26,29 +26,56 @@ class heraldo(BasicNewsRecipe):
delay = 1 delay = 1
max_articles_per_feed = 100 max_articles_per_feed = 100
use_embedded_content = False use_embedded_content = False
masthead_url = 'http://www.heraldo.es/MODULOS/global/publico/interfaces/img/logo-Heraldo.png' masthead_url = 'http://aureel.com/es/wp-content/uploads/sites/4/2016/07/Heraldo_de_Arago%CC%81n.png'
remove_empty_feeds = True remove_empty_feeds = True
remove_javascript = True remove_javascript = True
no_stylesheets = True no_stylesheets = True
feeds = [ feeds = [(u'Noticias', u'http://www.heraldo.es/index.php/mod.portadas/mem.rss')]
(u'Noticias', u'http://www.heraldo.es/index.php/mod.portadas/mem.rss')
keep_only_tags = [
dict(
name='div',
attrs={
'class':
['row-f2 brd-row-f4 bck-row-f1-f1 padd-t padd-btt con n-marg-btt']
}
),
dict(name='div', attrs={'id': ['dts', 'com']}),
dict(name='img', attrs={'class': ['lazy']})
] ]
keep_only_tags = [dict(name='div', attrs={'class': ['row-f2 brd-row-f4 bck-row-f1-f1 padd-t padd-btt con n-marg-btt']}), remove_tags = [
dict(name='div', attrs={'id': ['dts', 'com']}), dict(
dict(name='img', attrs={'class': ['lazy']})] name='a', attrs={'class': ['com flo-r', 'enl-if', 'enl-df', 'next_com']}
),
remove_tags = [dict(name='a', attrs={'class': ['com flo-r', 'enl-if', 'enl-df', 'next_com']}), dict(
dict(name='div', attrs={'class': ['brb-b-s con marg-btt', 'cnt-rel con', 'col5-f1', 'tit txt-wh f-s con', name='div',
'con cont-top ', 'col5-f1 flo-l', 'cnt-rel brr', 'caj_part con', 'caj_topic con']}), attrs={
dict(name='div', attrs={'id': [ 'class': [
'cont-Top-8760', 'caj-pub', '8760-cpt1', 'caj_topic con', 'slider-oferplan', 'cont-Top-']}), 'brb-b-s con marg-btt', 'cnt-rel con', 'col5-f1',
'tit txt-wh f-s con', 'con cont-top ', 'col5-f1 flo-l',
'cnt-rel brr', 'caj_part con', 'caj_topic con'
]
}
),
dict(
name='div',
attrs={
'id': [
'cont-Top-8760', 'caj-pub', '8760-cpt1', 'caj_topic con',
'slider-oferplan', 'cont-Top-'
]
}
),
dict(name='form', attrs={'class': 'form'}), dict(name='form', attrs={'class': 'form'}),
dict(name='ul', attrs={ dict(
'class': ['tabs-nav', 'men_nav con hg_2n', 'lst-not-f2 con ']}), name='ul',
attrs={'class': ['tabs-nav', 'men_nav con hg_2n', 'lst-not-f2 con ']}
),
dict(name='span', attrs={'class': ['flo-r']}), dict(name='span', attrs={'class': ['flo-r']}),
dict(name='ul', attrs={'id': ['cont-tags', 'pag-1', 'pag-cnt-I-']})] dict(name='ul', attrs={'id': ['cont-tags', 'pag-1', 'pag-cnt-I-']})
]
remove_tags_before = dict(name='div', attrs={'id': 'dts'}) remove_tags_before = dict(name='div', attrs={'id': 'dts'})
remove_tags_after = dict(name='div', attrs={'id': 'com'}) remove_tags_after = dict(name='div', attrs={'id': 'com'})
@ -59,15 +86,16 @@ class heraldo(BasicNewsRecipe):
year = str(st.tm_year) year = str(st.tm_year)
month = "%.2d" % st.tm_mon month = "%.2d" % st.tm_mon
day = "%.2d" % st.tm_mday day = "%.2d" % st.tm_mday
# http://oldorigin-www.heraldo.es/20101211/primeras/portada_aragon.pdf
cover = 'http://oldorigin-www.heraldo.es/' + year + \ # http://img.kiosko.net/2017/09/10/es/heraldo_aragon.750.jpg
month + day + '/primeras/portada_aragon.pdf' cover = 'http://img.kiosko.net/' + year + '/' + month + '/' + day + '/es/heraldo_aragon.750.jpg'
br = BasicNewsRecipe.get_browser(self) br = BasicNewsRecipe.get_browser(self)
try: try:
br.open(cover) br.open(cover)
except: except:
self.log("\nPortada no disponible") self.log("\nPortada no disponible")
cover = 'http://www.heraldo.es/MODULOS/global/publico/interfaces/img/logo-Heraldo.png' cover = 'http://aureel.com/es/wp-content/uploads/sites/4/2016/07/Heraldo_de_Arago%CC%81n.png'
return cover return cover
extra_css = ''' extra_css = '''
@ -81,13 +109,19 @@ class heraldo(BasicNewsRecipe):
preprocess_regexps = [ preprocess_regexps = [
# Para separar los comentarios con una linea en blanco # Para separar los comentarios con una linea en blanco
(re.compile(r'<div class="tit-f2">', re.DOTALL | re.IGNORECASE), (
lambda match: '<br /><br /><div class="tit-f2">'), re.compile(r'<div class="tit-f2">', re.DOTALL | re.IGNORECASE),
(re.compile(r'<div id="com"', re.DOTALL | re.IGNORECASE), lambda match: '<br /><br /><div class="tit-f2">'
lambda match: '<br><div id="com"'), ),
(
re.compile(r'<div id="com"', re.DOTALL | re.IGNORECASE),
lambda match: '<br><div id="com"'
),
# Para ver las imágenes de las noticias # Para ver las imágenes de las noticias
(re.compile(r'<img class="lazy" data-original="', re.DOTALL | (
re.IGNORECASE), lambda match: '<img src="http://www.heraldo.es') re.compile(
r'<img class="lazy" data-original="', re.DOTALL | re.IGNORECASE
), lambda match: '<img src="http://www.heraldo.es'
)
] ]