mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-09-29 15:31:08 -04:00
75 lines
3.1 KiB
Plaintext
75 lines
3.1 KiB
Plaintext
__license__ = 'GPL v3'
|
|
__copyright__ = '2008-2011, Darko Miletic <darko.miletic at gmail.com>'
|
|
'''
|
|
infobae.com
|
|
'''
|
|
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
class Infobae(BasicNewsRecipe):
|
|
title = 'Infobae.com'
|
|
__author__ = 'Darko Miletic and Sujata Raman'
|
|
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'
|
|
category = 'news, politics, Argentina'
|
|
oldest_article = 1
|
|
max_articles_per_feed = 100
|
|
no_stylesheets = True
|
|
use_embedded_content = False
|
|
language = 'es_AR'
|
|
encoding = 'utf8'
|
|
masthead_url = 'http://www.infobae.com/media/img/static/logo-infobae.gif'
|
|
remove_empty_feeds = True
|
|
extra_css = '''
|
|
body{font-family: Arial,Helvetica,sans-serif}
|
|
img{display: block}
|
|
.categoria{font-size: small; text-transform: uppercase}
|
|
'''
|
|
|
|
conversion_options = {
|
|
'comment' : description
|
|
, 'tags' : category
|
|
, 'publisher' : publisher
|
|
, 'language' : language
|
|
}
|
|
|
|
keep_only_tags = [dict(attrs={'class':['titularnota','nota','post-title','post-entry','entry-title','entry-info','entry-content']})]
|
|
remove_tags_after = dict(attrs={'class':['interior-noticia','nota-desc','tags']})
|
|
remove_tags = [
|
|
dict(name=['base','meta','link','iframe','object','embed','ins'])
|
|
,dict(attrs={'class':['barranota','tags']})
|
|
]
|
|
|
|
feeds = [
|
|
(u'Saludable' , u'http://www.infobae.com/rss/saludable.xml')
|
|
,(u'Economia' , u'http://www.infobae.com/rss/economia.xml' )
|
|
,(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 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 not item.has_key('alt'):
|
|
item['alt'] = 'image'
|
|
return soup
|
|
|
|
|