#!/usr/bin/env python # vim:fileencoding=UTF-8 __license__ = 'GPL v3' __copyright__ = '30 June 2012, desUBIKado' __author__ = 'desUBIKado' __description__ = 'Diario de actualidad, moda y belleza' __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' description = 'Diario de actualidad, moda y belleza' title = u'¡Hola!' publisher = 'Hola S.L.' category = 'Spanish celebrities, Entertainment News, Royalty, Daily Variety, Hollywood' language = 'es' masthead_url = 'http://imagenes.hola.com/comunes/2008/logo-holacom.gif' timefmt = '[%a, %d %b, %Y]' oldest_article = 7 delay = 1 encoding = 'utf-8' max_articles_per_feed = 100 use_embedded_content = False remove_empty_feeds = True remove_javascript = True no_stylesheets = True feeds = [ (u'Famosos', u'http://www.hola.com/famosos/rss.xml'), (u'Realeza', u'http://www.hola.com/realeza/rss.xml'), (u'Cine', u'http://www.hola.com/cine/rss.xml'), (u'M\xfasica', u'http://www.hola.com/musica/rss.xml'), (u'Moda y modelos', u'http://www.hola.com/moda/portada/rss.xml'), (u'Belleza y salud', u'http://www.hola.com/belleza/portada/rss.xml'), (u'Ni\xf1os', u'http://www.hola.com/ninos/rss.xml') ] keep_only_tags = [ dict(name='article', attrs={'class': ['body col-md-8 col-xs-12']})] 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={'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 None def get_article_url(self, article): url = article.get('guid', None) return url extra_css = ''' h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:30px;} h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal; font-style:italic; font-size:18px;} '''