mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Clarin
This commit is contained in:
parent
953a1d7573
commit
793021fcfd
@ -19,11 +19,11 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
|||||||
|
|
||||||
class Clarin(BasicNewsRecipe):
|
class Clarin(BasicNewsRecipe):
|
||||||
title = 'Clarín'
|
title = 'Clarín'
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = 'Darko Miletic, updated by GGsalas'
|
||||||
description = 'Clarin.com. Noticias de la Argentina y el mundo. Información actualizada las 24 horas y en español. Informate ya'
|
description = 'Clarin.com. Noticias de la Argentina y el mundo. Información actualizada las 24 horas y en español. Informate ya'
|
||||||
publisher = 'Grupo Clarin'
|
publisher = 'Grupo Clarin'
|
||||||
category = 'news, politics, Argentina'
|
category = 'news, politics, Argentina'
|
||||||
oldest_article = 2
|
oldest_article = 1
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
@ -36,43 +36,86 @@ class Clarin(BasicNewsRecipe):
|
|||||||
LOGIN = 'https://app-pase.clarin.com/pase-registracion/app/pase/ingresarNavegable?execution=e1s1'
|
LOGIN = 'https://app-pase.clarin.com/pase-registracion/app/pase/ingresarNavegable?execution=e1s1'
|
||||||
masthead_url = 'http://www.clarin.com/images/logo_clarin.svg'
|
masthead_url = 'http://www.clarin.com/images/logo_clarin.svg'
|
||||||
cover_url = strftime('http://tapas.clarin.com/tapa/%Y/%m/%d/%Y%m%d_thumb.jpg')
|
cover_url = strftime('http://tapas.clarin.com/tapa/%Y/%m/%d/%Y%m%d_thumb.jpg')
|
||||||
extra_css = """
|
|
||||||
body{font-family: Arial,Helvetica,sans-serif}
|
compress_news_images = True
|
||||||
h2{font-family: Georgia,serif; font-size: xx-large}
|
scale_news_images_to_device = True
|
||||||
.info,.nombre-autor,.hora{font-size: small}
|
compress_news_images_max_size = 10 # kB
|
||||||
.columnista-datos ul{list-style-type: none;}
|
scale_news_images = True
|
||||||
"""
|
handle_gzip = True
|
||||||
|
|
||||||
|
# To get all the data (images)
|
||||||
|
auto_cleanup = False
|
||||||
|
|
||||||
|
extra_css = """
|
||||||
|
h1#title {
|
||||||
|
line-height: 1em;
|
||||||
|
margin: 0 0 .5em 0;
|
||||||
|
}
|
||||||
|
p.volanta {
|
||||||
|
font-size: .7em;
|
||||||
|
margin-bottom: .5em;
|
||||||
|
}
|
||||||
|
.bajada h2 {
|
||||||
|
font-size: 1em;
|
||||||
|
line-height: 1em;
|
||||||
|
color: #666666;
|
||||||
|
margin: 0 0 1em 0;
|
||||||
|
}
|
||||||
|
.figcaption {
|
||||||
|
font-style: italic;
|
||||||
|
font-size: .9em;
|
||||||
|
margin-bottom: .5em;
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
conversion_options = {
|
conversion_options = {
|
||||||
'comment': description, 'tags': category, 'publisher': publisher, 'language': language
|
'comment': description, 'tags': category, 'publisher': publisher, 'language': language
|
||||||
}
|
}
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
dict(name='p' , attrs={'class' : 'volanta'}),
|
dict(name='p' , attrs={'class' : 'volanta'}),
|
||||||
dict(name='h1' , attrs={'itemprop': 'headline'}),
|
dict(name='h1' , attrs={'id': 'title'}),
|
||||||
dict(name='div', attrs={'class' : 'bajada'}),
|
dict(name='div', attrs={'class' : 'bajada'}),
|
||||||
dict(name='div', attrs={'class' : 'body-nota'})
|
dict(name='div', attrs={'id' : 'galeria-trigger'}),
|
||||||
]
|
dict(name='div', attrs={'class' : 'body-nota'})
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['meta', 'base', 'link', 'iframe', 'embed', 'object']),
|
dict(name=['meta', 'base', 'link', 'iframe', 'embed', 'object']),
|
||||||
dict(attrs={'class': ['tags-bar', 'breadcrumb', 'share-bar', 'share']}),
|
dict(attrs={'class': ['tags-bar', 'breadcrumb', 'share-bar', 'share', 'sp__SM']}),
|
||||||
dict(name='div', attrs={'class': lambda x: x and 'r-nota' in x.split()}),
|
dict(name='div', attrs={'class': lambda x: x and 'r-nota' in x.split()}),
|
||||||
dict(attrs={'id': ['relacionadas']}),
|
dict(attrs={'id': ['relacionadas']}),
|
||||||
dict(name='a', attrs={'class':'content-new'})
|
dict(name='a', attrs={'class':'content-new'})
|
||||||
]
|
]
|
||||||
|
|
||||||
remove_tags_after = dict(name='div', attrs={'id': 'relacionadas'})
|
remove_tags_after = dict(name='div', attrs={'id': 'relacionadas'})
|
||||||
|
|
||||||
remove_attributes = ['lang']
|
remove_attributes = ['lang']
|
||||||
|
|
||||||
|
# Images on hightlights view
|
||||||
|
def populate_article_metadata(self, article, soup, first):
|
||||||
|
if first and hasattr(self, 'add_toc_thumbnail'):
|
||||||
|
picdiv = soup.find('img')
|
||||||
|
if picdiv is not None:
|
||||||
|
self.add_toc_thumbnail(article, picdiv['src'])
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
(u'Lo Ultimo', u'http://www.clarin.com/rss/lo-ultimo/'),
|
(u'Lo Ultimo', u'http://www.clarin.com/rss/lo-ultimo/'),
|
||||||
(u'Politica', u'http://www.clarin.com/rss/politica/'),
|
(u'Politica', u'http://www.clarin.com/rss/politica/'),
|
||||||
(u'Deportes', u'http://www.clarin.com/rss/deportes/'),
|
(u'Opinion', u'https://www.clarin.com/rss/opinion/'),
|
||||||
(u'Mundo', u'http://www.clarin.com/rss/mundo/'),
|
(u'Cultura', u'https://www.clarin.com/rss/cultura/'),
|
||||||
(u'Espectaculos', u'http://www.clarin.com/rss/espectaculos/'),
|
(u'Economia', u'https://www.clarin.com/rss/economia/'),
|
||||||
(u'Sociedad', u'http://www.clarin.com/rss/sociedad/'),
|
(u'Tecnologia', u'https://www.clarin.com/rss/tecnologia/'),
|
||||||
(u'Ciudades', u'http://www.clarin.com/rss/ciudades/'),
|
(u'RevistaN', u'https://www.clarin.com/rss/revista-enie/'),
|
||||||
(u'Policiales', u'http://www.clarin.com/rss/policiales/'),
|
(u'Viva', u'https://www.clarin.com/rss/viva/'),
|
||||||
(u'Internet', u'http://www.clarin.com/rss/internet/')
|
(u'Deportes', u'http://www.clarin.com/rss/deportes/'),
|
||||||
|
(u'Mundo', u'http://www.clarin.com/rss/mundo/'),
|
||||||
|
(u'Espectaculos', u'http://www.clarin.com/rss/espectaculos/'),
|
||||||
|
(u'Sociedad', u'http://www.clarin.com/rss/sociedad/'),
|
||||||
|
(u'Ciudades', u'http://www.clarin.com/rss/ciudades/'),
|
||||||
|
(u'Policiales', u'http://www.clarin.com/rss/policiales/'),
|
||||||
|
(u'Internet', u'http://www.clarin.com/rss/internet/')
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self):
|
||||||
@ -87,3 +130,23 @@ class Clarin(BasicNewsRecipe):
|
|||||||
})
|
})
|
||||||
br.open(self.LOGIN, data)
|
br.open(self.LOGIN, data)
|
||||||
return br
|
return br
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
for img in soup.findAll(['img']):
|
||||||
|
img['src'] = img['data-big']
|
||||||
|
|
||||||
|
for figCaption in soup.findAll(['figcaption']):
|
||||||
|
figCaption.name = 'div'
|
||||||
|
figCaption['class'] = 'figcaption'
|
||||||
|
|
||||||
|
return soup
|
||||||
|
|
||||||
|
def postprocess_html(self, soup, first_fetch):
|
||||||
|
for t in soup.findAll(['a']):
|
||||||
|
t.name = 'strong'
|
||||||
|
|
||||||
|
nonBreakSpace = u'\xa0'
|
||||||
|
for empty in soup.findAll('p', string=nonBreakSpace):
|
||||||
|
empty.extract()
|
||||||
|
|
||||||
|
return soup
|
||||||
|
Loading…
x
Reference in New Issue
Block a user