From 643977ffa60f9c03454bd208a2062d3919d291f8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 29 Jul 2016 11:00:39 +0530 Subject: [PATCH] Update Hola --- recipes/hola.recipe | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/recipes/hola.recipe b/recipes/hola.recipe index 6f7c9e4a6a..bb36384752 100644 --- a/recipes/hola.recipe +++ b/recipes/hola.recipe @@ -1,19 +1,20 @@ -#!/usr/bin/env python2 -# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai +#!/usr/bin/env python2 +# vim:fileencoding=UTF-8 __license__ = 'GPL v3' __copyright__ = '30 June 2012, desUBIKado' __author__ = 'desUBIKado' __description__ = 'Diario de actualidad, moda y belleza' -__version__ = 'v0.01' -__date__ = '30, June 2012' +__version__ = 'v0.03' +__date__ = '28, Jul 2016' ''' http://www.hola.com/ ''' +import re from calibre.web.feeds.news import BasicNewsRecipe class hola_es(BasicNewsRecipe): - __author__ = 'desUBIKado' + author = 'desUBIKado' description = 'Diario de actualidad, moda y belleza' title = u'¡Hola!' publisher = 'Hola S.L.' @@ -43,23 +44,42 @@ class hola_es(BasicNewsRecipe): - keep_only_tags = [dict(name='div', attrs={'id':['cuerpo','com']})] + keep_only_tags = [dict(name='article', attrs={'class':['body col-md-8 col-xs-12']})] - remove_tags = [dict(name='div', attrs={'id':['relacionadas','slide-enlaces-patrocinados','comentarios']}), - dict(name='div', attrs={'class':['slide-enlaces-patricinados-tit','compartir']}) + + remove_tags = [dict(name='div', attrs={'class':['comments','news-share','sponsored-news']}), + dict(name='div', attrs={'itemprop':['logo']}), + dict(name='span', attrs={'class':['hidden']}), + dict(name='p', attrs={'class':['hidden']}), + dict(name='section', attrs={'class':['news-tags']}) ] - remove_tags_after = dict(name='div' , attrs={'id':'comentarios'}) + + + remove_tags_after = dict(name='div' , attrs={'class':'comments'}) + + + # VER GALERÍA + preprocess_regexps = [ + # Quitar VER GALERÍA + (re.compile(r'VER GALER', re.DOTALL|re.IGNORECASE), lambda m: ''), + # Quitar enlaces varios + (re.compile(r'

', re.DOTALL|re.IGNORECASE), lambda m: '') + ] # Recuperamos la portada de papel (la imagen 520 tiene mayor resolucion) - + # http://www.hola.com/imagenes/revista/3727/portada-revista-hola-520.jpg def get_cover_url(self): index = 'http://www.hola.com/abono/ediciondigital/' soup = self.index_to_soup(index) for image in soup.findAll('img',src=True): if image['src'].endswith('portada-revista-hola-520.jpg'): - return 'http://www.hola.com/' + image['src'] + return 'http://www.hola.com' + image['src'] return None