Update El Mundo

Fixes #1728386 [Updated recipe for spanish El Mundo](https://bugs.launchpad.net/calibre/+bug/1728386)
This commit is contained in:
Kovid Goyal 2017-10-29 23:48:38 +05:30
parent 8fe42fbe2c
commit 1dfe8ebee8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 35 additions and 57 deletions

View File

@ -1,7 +1,9 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
# vim:fileencoding=utf-8 # vim:fileencoding=utf-8
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2009-2013, Darko Miletic <darko.miletic at gmail.com>' __copyright__ = '2009-2017, Darko Miletic <darko.miletic at gmail.com>'
''' '''
elmundo.es elmundo.es
''' '''
@ -25,17 +27,16 @@ class ElMundo(BasicNewsRecipe):
remove_empty_feeds = True remove_empty_feeds = True
language = 'es' language = 'es'
ignore_duplicate_articles = {'url'} ignore_duplicate_articles = {'url'}
masthead_url = 'http://estaticos03.elmundo.es/assets/desktop/master/img/iconos/elmundo-portada.png' masthead_url = 'http://e00-elmundo.uecdn.es/assets/v7/img/svg/elmundo.svg'
publication_type = 'newspaper' publication_type = 'newspaper'
articles_are_obfuscated = True articles_are_obfuscated = True
auto_cleanup = True
temp_files = [] temp_files = []
needs_subscription = 'optional'
LOGIN = 'https://seguro.elmundo.es/registro/login.html'
extra_css = """ extra_css = """
body{font-family: Arial,Helvetica,sans-serif} body{font-family: "PT serif",Georgia,serif,times}
.metadata_noticia{font-size: small} .metadata_noticia{font-size: small}
.pestana_GDP{font-size: small; font-weight:bold} .pestana_GDP{font-size: small; font-weight:bold}
h1 {color: #333333; font-family: Georgia,"Times New Roman",Times,serif} h1 {color: #333333; font-family: "Clear Sans Bold",Arial,sans-serif,helvetica}
.hora{color: red} .hora{color: red}
.update{color: gray} .update{color: gray}
""" """
@ -44,62 +45,37 @@ class ElMundo(BasicNewsRecipe):
'comments': description, 'tags': category, 'language': language, 'publisher': publisher 'comments': description, 'tags': category, 'language': language, 'publisher': publisher
} }
remove_tags_before = dict( remove_tags = [dict(attrs={'class': lambda x: x and ('aside-tools' or 'publicidad') in x.split()})]
attrs={'class': ['titular', 'antetitulo', 'entrada']})
remove_tags_after = dict(
name='div', attrs={'id': ['desarrollo_noticia', 'tamano']})
remove_tags = [
dict(name='div', attrs={'class': 'comentarios'}),
dict(name=['meta', 'link', 'iframe', 'object'])
]
remove_attributes = ['lang', 'border']
def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
if self.username is not None and self.password is not None:
br.open(self.LOGIN)
br.select_form(name='login')
br['nick'] = self.username
br['clave'] = self.password
br.submit()
return br
feeds = [ feeds = [
(u'Portada', u'http://elmundo.feedsportal.com/elmundo/rss/portada.xml'), (u'Portada', u'http://estaticos.elmundo.es/elmundo/rss/portada.xml'),
(u'Deportes', u'http://elmundo.feedsportal.com/elmundodeporte/rss/portada.xml'), (u'Deportes', u'http://estaticos.elmundo.es/elmundodeporte/rss/portada.xml'),
(u'Econom\xeda', u'http://elmundo.feedsportal.com/elmundo/rss/economia.xml'), (u'Economia', u'http://estaticos.elmundo.es/elmundo/rss/economia.xml'),
(u'Espa\xf1a', u'http://elmundo.feedsportal.com/elmundo/rss/espana.xml'), (u'Espa\xf1a', u'http://estaticos.elmundo.es/elmundo/rss/espana.xml'),
(u'Internacional', u'http://elmundo.feedsportal.com/elmundo/rss/internacional.xml'), (u'Internacional', u'http://estaticos.elmundo.es/elmundo/rss/internacional.xml'),
(u'Cultura', u'http://elmundo.feedsportal.com/elmundo/rss/internacional.xml'), (u'Cultura', u'http://estaticos.elmundo.es/elmundo/rss/cultura.xml'),
(u'Ciencia/Ecolog\xeda', u'http://elmundo.feedsportal.com/elmundo/rss/ciencia.xml'), (u'Ciencia/Ecolog\xeda', u'http://estaticos.elmundo.es/elmundo/rss/ciencia.xml'),
(u'Comunicaci\xf3n', u'http://elmundo.feedsportal.com/elmundo/rss/comunicacion.xml'), (u'Comunicaci\xf3n', u'http://estaticos.elmundo.es/elmundo/rss/comunicacion.xml'),
(u'Televisi\xf3n', u'http://elmundo.feedsportal.com/elmundo/rss/television.xml'), (u'Televisi\xf3n', u'http://estaticos.elmundo.es/elmundo/rss/television.xml'),
(u'Salud', u'http://elmundo.feedsportal.com/elmundosalud/rss/portada.xml'), (u'Salud', u'http://estaticos.elmundo.es/elmundosalud/rss/portada.xml'),
(u'Solidaridad', u'http://elmundo.feedsportal.com/elmundo/rss/solidaridad.xml'), (u'Solidaridad', u'http://estaticos.elmundo.es/elmundo/rss/solidaridad.xml'),
(u'Su vivienda', u'http://elmundo.feedsportal.com/elmundo/rss/suvivienda.xml'), (u'Su vivienda', u'http://estaticos.elmundo.es/elmundo/rss/suvivienda.xml'),
(u'Motor', u'http://elmundo.feedsportal.com/elmundodeporte/rss/motor.xml'), (u'Motor', u'http://estaticos.elmundo.es/elmundodeporte/rss/motor.xml'),
(u'Madrid', u'http://elmundo.feedsportal.com/elmundo/rss/madrid.xml'), (u'Madrid', u'http://estaticos.elmundo.es/elmundo/rss/madrid.xml'),
(u'Barcelona', u'http://elmundo.feedsportal.com/elmundo/rss/barcelona.xml'), (u'Barcelona', u'http://estaticos.elmundo.es/elmundo/rss/barcelona.xml'),
(u'Pa\xeds Vasco', u'http://elmundo.feedsportal.com/elmundo/rss/paisvasco.xml'), (u'Pa\xeds Vasco', u'http://estaticos.elmundo.es/elmundo/rss/paisvasco.xml'),
(u'Baleares', u'http://elmundo.feedsportal.com/elmundo/rss/baleares.xml'), (u'Baleares', u'http://estaticos.elmundo.es/elmundo/rss/baleares.xml'),
(u'Castilla y Le\xf3n', u'http://elmundo.feedsportal.com/elmundo/rss/castillayleon.xml'), (u'Castilla y Le\xf3n', u'http://estaticos.elmundo.es/elmundo/rss/castillayleon.xml'),
(u'Valladolid', u'http://elmundo.feedsportal.com/elmundo/rss/valladolid.xml'), (u'Valladolid', u'http://estaticos.elmundo.es/elmundo/rss/valladolid.xml'),
(u'Valencia', u'http://elmundo.feedsportal.com/elmundo/rss/valencia.xml'), (u'Valencia', u'http://estaticos.elmundo.es/elmundo/rss/valencia.xml'),
(u'Alicante', u'http://elmundo.feedsportal.com/elmundo/rss/alicante.xml'), (u'Alicante', u'http://estaticos.elmundo.es/elmundo/rss/alicante.xml'),
(u'Castell\xf3n', u'http://elmundo.feedsportal.com/elmundo/rss/castellon.xml'), (u'Castell\xf3n', u'http://estaticos.elmundo.es/elmundo/rss/castellon.xml'),
(u'Andaluc\xeda', u'http://elmundo.feedsportal.com/elmundo/rss/andalucia.xml'), (u'Andaluc\xeda', u'http://estaticos.elmundo.es/elmundo/rss/andalucia.xml'),
(u'Sevilla', u'http://elmundo.feedsportal.com/elmundo/rss/andalucia_sevilla.xml'), (u'Sevilla', u'http://estaticos.elmundo.es/elmundo/rss/andalucia_sevilla.xml'),
(u'M\xe1laga', u'http://elmundo.feedsportal.com/elmundo/rss/andalucia_malaga.xml') (u'M\xe1laga', u'http://estaticos.elmundo.es/elmundo/rss/andalucia_malaga.xml')
] ]
def get_article_url(self, article):
realurl = article.get('guid', None)
if '/album/' in realurl or '/envivos/' in realurl:
return None
return realurl
# Obtener la imagen de portada
def get_cover_url(self): def get_cover_url(self):
cover = self.masthead_url cover = self.masthead_url
st = time.localtime() st = time.localtime()
@ -137,4 +113,6 @@ class ElMundo(BasicNewsRecipe):
def image_url_processor(self, baseurl, url): def image_url_processor(self, baseurl, url):
if url.startswith('//'): if url.startswith('//'):
return 'http:' + url return 'http:' + url
if url.startswith('file://'):
return url.replace('file://', 'http://')
return url return url

Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 488 B