mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-09-29 15:31:08 -04:00
86 lines
3.8 KiB
Plaintext
86 lines
3.8 KiB
Plaintext
__license__ = 'GPL v3'
|
|
__copyright__ = '2010-2011, Darko Miletic <darko.miletic at gmail.com>'
|
|
'''
|
|
perfil.com
|
|
'''
|
|
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
class Perfil(BasicNewsRecipe):
|
|
title = 'Perfil'
|
|
__author__ = 'Darko Miletic'
|
|
description = 'Noticias de Argentina y el resto del mundo'
|
|
publisher = 'perfil.com'
|
|
category = 'news, politics, Argentina'
|
|
oldest_article = 2
|
|
max_articles_per_feed = 200
|
|
no_stylesheets = True
|
|
encoding = 'cp1252'
|
|
use_embedded_content = False
|
|
language = 'es_AR'
|
|
remove_empty_feeds = True
|
|
masthead_url = 'http://www.perfil.com/export/sites/diarioperfil/arte/10/logo_perfilcom_mm.gif'
|
|
extra_css = """
|
|
body{font-family: Arial,Helvetica,sans-serif }
|
|
.seccion{border-bottom: 1px dotted #666666; text-transform: uppercase; font-size: x-large}
|
|
.foto1 h1{font-size: x-small}
|
|
h1{font-family: Georgia,"Times New Roman",serif}
|
|
img{margin-bottom: 0.4em}
|
|
.hora{font-size: x-small; color: red}
|
|
"""
|
|
|
|
conversion_options = {
|
|
'comment' : description
|
|
, 'tags' : category
|
|
, 'publisher' : publisher
|
|
, 'language' : language
|
|
}
|
|
|
|
remove_tags = [
|
|
dict(name=['iframe','embed','object','base','meta','link'])
|
|
,dict(name='a', attrs={'href':'#comentarios'})
|
|
,dict(name='div', attrs={'class':'foto3'})
|
|
,dict(name='img', attrs={'alt':['ampliar','Ampliar']})
|
|
]
|
|
keep_only_tags=[dict(attrs={'class':['articulo','cuerpoSuperior']})]
|
|
remove_attributes=['onload','lang','width','height','border']
|
|
|
|
feeds = [
|
|
(u'Ultimo momento' , u'http://www.perfil.com/rss/ultimomomento.xml')
|
|
,(u'Politica' , u'http://www.perfil.com/rss/politica.xml' )
|
|
,(u'Policia' , u'http://www.perfil.com/rss/policia.xml' )
|
|
,(u'Internacionales', u'http://www.perfil.com/rss/internacional.xml')
|
|
,(u'Economia' , u'http://www.perfil.com/rss/economia.xml' )
|
|
,(u'Deportes' , u'http://www.perfil.com/rss/deportes.xml' )
|
|
,(u'Opinion' , u'http://www.perfil.com/rss/columnistas.xml' )
|
|
,(u'Sociedad' , u'http://www.perfil.com/rss/sociedad.xml' )
|
|
,(u'Cultura' , u'http://www.perfil.com/rss/cultura.xml' )
|
|
,(u'Espectaculos' , u'http://www.perfil.com/rss/espectaculos.xml' )
|
|
,(u'Ciencia' , u'http://www.perfil.com/rss/ciencia.xml' )
|
|
,(u'Salud' , u'http://www.perfil.com/rss/salud.xml' )
|
|
,(u'Tecnologia' , u'http://www.perfil.com/rss/tecnologia.xml' )
|
|
]
|
|
|
|
def get_article_url(self, article):
|
|
return article.get('guid', None)
|
|
|
|
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
|
|
|