From 1b902b7a686ca2c7c46c5006955934be4a59c136 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 12 Jul 2018 19:01:52 +0530 Subject: [PATCH] Update El cohete a la luna Fixes #1781400 [Updated recipe for El cohete a la luna](https://bugs.launchpad.net/calibre/+bug/1781400) --- recipes/elcohetealaluna.recipe | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/recipes/elcohetealaluna.recipe b/recipes/elcohetealaluna.recipe index 7fd0306948..a0e3919d35 100644 --- a/recipes/elcohetealaluna.recipe +++ b/recipes/elcohetealaluna.recipe @@ -2,14 +2,13 @@ # -*- coding: utf-8 -*- __license__ = 'GPL v3' -__copyright__ = '2017, Darko Miletic ' +__copyright__ = '2017 - 2018, Darko Miletic ' ''' www.elcohetealaluna.com ''' from calibre.web.feeds.news import BasicNewsRecipe - class elcohetealaluna(BasicNewsRecipe): title = 'El Cohete a la Luna' __author__ = 'Darko Miletic' @@ -23,10 +22,15 @@ class elcohetealaluna(BasicNewsRecipe): language = 'es_AR' remove_empty_feeds = True publication_type = 'newsportal' - auto_cleanup = True + auto_cleanup = False resolve_internal_links = True + compress_news_images = True + masthead_url = 'https://www.elcohetealaluna.com/wp-content/uploads/2018/06/logo-menu.png' + extra_css = """ - body{font-family: serif} + body{font-family: Georgia, Times, "Times New Roman", serif} + h1,h2,.post-author-name{font-family: Oswald, sans-serif} + h2{color: gray} img{margin-top:1em; margin-bottom: 1em; display:block} """ @@ -34,4 +38,16 @@ class elcohetealaluna(BasicNewsRecipe): 'comment': description, 'tags': category, 'publisher': publisher, 'language': language } + keep_only_tags=[ + dict(name='div', attrs={'class': lambda x: x and 'post-header' in x.split()}), + dict(name='div', attrs={'class': lambda x: x and 'entry-content' in x.split()}), + ] + feeds = [(u'Articulos', u'https://www.elcohetealaluna.com/feed/')] + + def preprocess_html(self, soup): + for image in soup.findAll(name='img'): + if image.has_key('data-src'): + image['src'] = image['data-src'] + return soup +