mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Update iProfesional. Fixes #1653101 [Updated recipe for iProfesional](https://bugs.launchpad.net/calibre/+bug/1653101)
This commit is contained in:
parent
ef16647400
commit
e65c2feeac
@ -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
|
||||
'''
|
||||
@ -22,19 +26,26 @@ class iProfesional(BasicNewsRecipe):
|
||||
publication_type = 'newsportal'
|
||||
masthead_url = 'http://www.iprofesional.com/img/header/logoiprofesional.png'
|
||||
extra_css = """
|
||||
body{font-family: 'Droid Sans',Arial,sans-serif }
|
||||
body{font-family: "Open Sans", sans-serif}
|
||||
img{margin-bottom: 0.4em; display:block}
|
||||
.titulo{font-family: WhitneyBoldWhitneyBold,Arial,Helvetica,sans-serif; color: blue}
|
||||
.fecha-archivo{font-weight: bold; color: rgb(205, 150, 24)}
|
||||
.description{font-weight: bold; color: gray }
|
||||
.firma{font-size: small}
|
||||
.tituloprincipal{font-family: WhitneyBold, Arial, sans-serif;
|
||||
font-weight: bold;
|
||||
font-size: x-large;
|
||||
display: block; margin-bottom: 1em;}
|
||||
.bajadanh{font-size: small; display: block; margin-bottom: 1em;}
|
||||
"""
|
||||
|
||||
conversion_options = {
|
||||
'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 = [
|
||||
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'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
|
||||
|
Loading…
x
Reference in New Issue
Block a user