Update iProfesional. Fixes #1653101 [Updated recipe for iProfesional](https://bugs.launchpad.net/calibre/+bug/1653101)

This commit is contained in:
Kovid Goyal 2016-12-30 08:32:45 +05:30
parent ef16647400
commit e65c2feeac

View File

@ -1,4 +1,8 @@
__copyright__ = '2011-2013, Darko Miletic <darko.miletic at gmail.com>' #!/usr/bin/env python2
# -*- mode: python -*-
# -*- coding: utf-8 -*-
__copyright__ = '2011-2016, Darko Miletic <darko.miletic at gmail.com>'
''' '''
www.iprofesional.com www.iprofesional.com
''' '''
@ -22,19 +26,26 @@ class iProfesional(BasicNewsRecipe):
publication_type = 'newsportal' publication_type = 'newsportal'
masthead_url = 'http://www.iprofesional.com/img/header/logoiprofesional.png' masthead_url = 'http://www.iprofesional.com/img/header/logoiprofesional.png'
extra_css = """ extra_css = """
body{font-family: 'Droid Sans',Arial,sans-serif } body{font-family: "Open Sans", sans-serif}
img{margin-bottom: 0.4em; display:block} img{margin-bottom: 0.4em; display:block}
.titulo{font-family: WhitneyBoldWhitneyBold,Arial,Helvetica,sans-serif; color: blue} .tituloprincipal{font-family: WhitneyBold, Arial, sans-serif;
.fecha-archivo{font-weight: bold; color: rgb(205, 150, 24)} font-weight: bold;
.description{font-weight: bold; color: gray } font-size: x-large;
.firma{font-size: small} display: block; margin-bottom: 1em;}
.bajadanh{font-size: small; display: block; margin-bottom: 1em;}
""" """
conversion_options = { conversion_options = {
'comment': description, 'tags': category, 'publisher': publisher, 'language': language 'comment': description, 'tags': category, 'publisher': publisher, 'language': language
} }
keep_only_tags = [dict(attrs={'class': 'desarrollo'})] keep_only_tags = [
dict(name='div', attrs={'class': lambda x: x and 'tituloprincipal' in x.split()})
,dict(name='div', attrs={'class': lambda x: x and 'bajadanh' in x.split()})
,dict(name='div', attrs={'class': lambda x: x and 'datosautornh' in x.split()})
,dict(name='div', attrs={'class': lambda x: x and 'fotonotanh' in x.split()})
,dict(name='div', attrs={'class': lambda x: x and 'contenidonotanh' in x.split()})
]
remove_tags = [ remove_tags = [
dict(name=['meta', 'link', 'base', 'embed', 'object', 'iframe'])] dict(name=['meta', 'link', 'base', 'embed', 'object', 'iframe'])]
@ -52,23 +63,3 @@ class iProfesional(BasicNewsRecipe):
(u'Autos', u'http://feeds.feedburner.com/iprofesional-autos'), (u'Autos', u'http://feeds.feedburner.com/iprofesional-autos'),
(u'Vinos', u'http://feeds.feedburner.com/iprofesional-vinos-bodegas') (u'Vinos', u'http://feeds.feedburner.com/iprofesional-vinos-bodegas')
] ]
def preprocess_html(self, soup):
for item in soup.findAll(style=True):
del item['style']
for item in soup.findAll('a'):
limg = item.find('img')
if item.string is not None:
str = item.string
item.replaceWith(str)
else:
if limg:
item.name = 'div'
item.attrs = []
else:
str = self.tag_to_string(item)
item.replaceWith(str)
for item in soup.findAll('img'):
if 'alt' not in item:
item['alt'] = 'image'
return soup