mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #803589 (Updated recipe for Infobae)
This commit is contained in:
parent
ca69bebe03
commit
a26d1a519f
@ -1,5 +1,5 @@
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008-2010, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2008-2011, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
infobae.com
|
infobae.com
|
||||||
'''
|
'''
|
||||||
@ -9,7 +9,7 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
|||||||
class Infobae(BasicNewsRecipe):
|
class Infobae(BasicNewsRecipe):
|
||||||
title = 'Infobae.com'
|
title = 'Infobae.com'
|
||||||
__author__ = 'Darko Miletic and Sujata Raman'
|
__author__ = 'Darko Miletic and Sujata Raman'
|
||||||
description = 'Informacion Libre las 24 horas'
|
description = 'Infobae.com es el sitio de noticias con mayor actualizacion de Latinoamérica. Noticias actualizadas las 24 horas, los 365 días del año.'
|
||||||
publisher = 'Infobae.com'
|
publisher = 'Infobae.com'
|
||||||
category = 'news, politics, Argentina'
|
category = 'news, politics, Argentina'
|
||||||
oldest_article = 1
|
oldest_article = 1
|
||||||
@ -17,13 +17,13 @@ class Infobae(BasicNewsRecipe):
|
|||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
language = 'es_AR'
|
language = 'es_AR'
|
||||||
encoding = 'cp1252'
|
encoding = 'utf8'
|
||||||
masthead_url = 'http://www.infobae.com/imgs/header/header.gif'
|
masthead_url = 'http://www.infobae.com/media/img/static/logo-infobae.gif'
|
||||||
remove_javascript = True
|
|
||||||
remove_empty_feeds = True
|
remove_empty_feeds = True
|
||||||
extra_css = '''
|
extra_css = '''
|
||||||
body{font-family:Arial,Helvetica,sans-serif;}
|
body{font-family: Arial,Helvetica,sans-serif}
|
||||||
.popUpTitulo{color:#0D4261; font-size: xx-large}
|
img{display: block}
|
||||||
|
.categoria{font-size: small; text-transform: uppercase}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
conversion_options = {
|
conversion_options = {
|
||||||
@ -31,26 +31,44 @@ class Infobae(BasicNewsRecipe):
|
|||||||
, 'tags' : category
|
, 'tags' : category
|
||||||
, 'publisher' : publisher
|
, 'publisher' : publisher
|
||||||
, 'language' : language
|
, 'language' : language
|
||||||
, 'linearize_tables' : True
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keep_only_tags = [dict(attrs={'class':['titularnota','nota','post-title','post-entry','entry-title','entry-info','entry-content']})]
|
||||||
feeds = [
|
remove_tags_after = dict(attrs={'class':['interior-noticia','nota-desc','tags']})
|
||||||
(u'Noticias' , u'http://www.infobae.com/adjuntos/html/RSS/hoy.xml' )
|
remove_tags = [
|
||||||
,(u'Salud' , u'http://www.infobae.com/adjuntos/html/RSS/salud.xml' )
|
dict(name=['base','meta','link','iframe','object','embed','ins'])
|
||||||
,(u'Tecnologia', u'http://www.infobae.com/adjuntos/html/RSS/tecnologia.xml')
|
,dict(attrs={'class':['barranota','tags']})
|
||||||
,(u'Deportes' , u'http://www.infobae.com/adjuntos/html/RSS/deportes.xml' )
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def print_version(self, url):
|
feeds = [
|
||||||
article_part = url.rpartition('/')[2]
|
(u'Saludable' , u'http://www.infobae.com/rss/saludable.xml')
|
||||||
article_id= article_part.partition('-')[0]
|
,(u'Economia' , u'http://www.infobae.com/rss/economia.xml' )
|
||||||
return 'http://www.infobae.com/notas/nota_imprimir.php?Idx=' + article_id
|
,(u'En Numeros', u'http://www.infobae.com/rss/rating.xml' )
|
||||||
|
,(u'Finanzas' , u'http://www.infobae.com/rss/finanzas.xml' )
|
||||||
|
,(u'Mundo' , u'http://www.infobae.com/rss/mundo.xml' )
|
||||||
|
,(u'Sociedad' , u'http://www.infobae.com/rss/sociedad.xml' )
|
||||||
|
,(u'Politica' , u'http://www.infobae.com/rss/politica.xml' )
|
||||||
|
,(u'Deportes' , u'http://www.infobae.com/rss/deportes.xml' )
|
||||||
|
]
|
||||||
|
|
||||||
def postprocess_html(self, soup, first):
|
def preprocess_html(self, soup):
|
||||||
for tag in soup.findAll(name='strong'):
|
for item in soup.findAll(style=True):
|
||||||
tag.name = 'b'
|
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 not item.has_key('alt'):
|
||||||
|
item['alt'] = 'image'
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user