mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update El Pais Impreso
Fixes #1299650 [Updated recipe for El Pais](https://bugs.launchpad.net/calibre/+bug/1299650)
This commit is contained in:
parent
2a333aa46a
commit
b3e6939edf
@ -1,16 +1,17 @@
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2010-2012, Darko Miletic <darko.miletic at gmail.com>'
|
||||
__copyright__ = '2010-2014, Darko Miletic <darko.miletic at gmail.com>'
|
||||
'''
|
||||
www.elpais.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.'
|
||||
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
|
||||
@ -22,6 +23,7 @@ class ElPais_RSS(BasicNewsRecipe):
|
||||
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}
|
||||
@ -80,35 +82,9 @@ class ElPais_RSS(BasicNewsRecipe):
|
||||
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)):
|
||||
urlverified = self.browser.open_novisit(url).geturl()
|
||||
return urlverified
|
||||
return url
|
||||
self.log('Skipping non-article', url)
|
||||
return None
|
||||
|
||||
def get_cover_url(self):
|
||||
soup = self.index_to_soup('http://elpais.com/')
|
||||
for image in soup.findAll('img'):
|
||||
if image['src'].endswith('elpaisTodayMiddle.jpg'):
|
||||
sstr = image['src']
|
||||
return sstr.replace('elpaisTodayMiddle.jpg', 'elpaisToday.jpg')
|
||||
return None
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
for item in soup.findAll(style=True):
|
||||
del item['style']
|
||||
for item in soup.findAll('a'):
|
||||
if item.string is not None:
|
||||
tstr = item.string
|
||||
item.replaceWith(tstr)
|
||||
else:
|
||||
item.name='span'
|
||||
for atrs in ['href','target','alt','title']:
|
||||
if item.has_key(atrs):
|
||||
del item[atrs]
|
||||
for item in soup.findAll('img',alt=False):
|
||||
item['alt'] = 'image'
|
||||
return soup
|
||||
|
||||
def preprocess_raw_html(self, raw, url):
|
||||
return '<html><head><title>Untitled</title>'+raw[raw.find('</head>'):]
|
||||
|
Loading…
x
Reference in New Issue
Block a user