mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Update Pagina 12
Fixes #1646825 [Updated recipe for Pagina 12](https://bugs.launchpad.net/calibre/+bug/1646825)
This commit is contained in:
parent
cf981fd447
commit
c925629fe7
@ -1,5 +1,8 @@
|
|||||||
|
# -*- mode: python -*-
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008-2012, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2008-2016, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
pagina12.com.ar
|
pagina12.com.ar
|
||||||
'''
|
'''
|
||||||
@ -14,21 +17,21 @@ class Pagina12(BasicNewsRecipe):
|
|||||||
publisher = 'La Pagina S.A.'
|
publisher = 'La Pagina S.A.'
|
||||||
category = 'news, politics, Argentina'
|
category = 'news, politics, Argentina'
|
||||||
oldest_article = 2
|
oldest_article = 2
|
||||||
max_articles_per_feed = 200
|
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
encoding = 'cp1252'
|
encoding = 'utf8'
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
language = 'es_AR'
|
language = 'es_AR'
|
||||||
remove_empty_feeds = True
|
remove_empty_feeds = True
|
||||||
publication_type = 'newspaper'
|
publication_type = 'newspaper'
|
||||||
masthead_url = 'http://www.pagina12.com.ar/commons/imgs/logo-home.gif'
|
auto_cleanup = False
|
||||||
|
PREFIX = 'https://www.pagina12.com.ar'
|
||||||
extra_css = """
|
extra_css = """
|
||||||
body{font-family: Arial,Helvetica,sans-serif }
|
body{font-family: Lora,serif}
|
||||||
|
.article-date{font-size: small; margin-bottom: 0.4em;}
|
||||||
|
.article-title{font-size: x-large; font-weight: bold; display: block; margin-bottom: 1em; margin-top: 1em;}
|
||||||
|
.article-main-media{display: block; margin-bottom: 0.4em;}
|
||||||
|
.article-summary{margin-bottom: 0.4em; display:block}
|
||||||
img{margin-bottom: 0.4em; display:block}
|
img{margin-bottom: 0.4em; display:block}
|
||||||
#autor{font-weight: bold}
|
|
||||||
#fecha,#epigrafe{font-size: 0.9em; margin: 5px}
|
|
||||||
#imagen{border: 1px solid black; margin: 0 0 1.25em 1.25em; width: 232px }
|
|
||||||
.fgprincipal{font-size: large; font-weight: bold}
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
conversion_options = {
|
conversion_options = {
|
||||||
@ -36,49 +39,45 @@ class Pagina12(BasicNewsRecipe):
|
|||||||
}
|
}
|
||||||
|
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['meta', 'link']), dict(name='div', attrs={
|
dict(name=['meta', 'link']),
|
||||||
'id': ['volver', 'logo', 'logo_suple', 'fin', 'permalink']})
|
]
|
||||||
|
|
||||||
|
keep_only_tags=[
|
||||||
|
dict(name='div', attrs={'class':[
|
||||||
|
'article-date',
|
||||||
|
'article-main-media-image',
|
||||||
|
'article-prefix',
|
||||||
|
'article-title',
|
||||||
|
'article-summary',
|
||||||
|
'article-text'
|
||||||
|
]})
|
||||||
]
|
]
|
||||||
remove_attributes = ['lang']
|
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
|
(u'Edicion impresa', u'https://www.pagina12.com.ar/rss/edicion-impresa'),
|
||||||
(u'Edicion impresa', u'http://www.pagina12.com.ar/diario/rss/principal.xml'),
|
(u'Espectaculos' , u'https://www.pagina12.com.ar/rss/suplementos/cultura-y-espectaculos/notas'),
|
||||||
(u'Espectaculos', u'http://www.pagina12.com.ar/diario/rss/espectaculos.xml'),
|
(u'Radar' , u'https://www.pagina12.com.ar/rss/suplementos/radar/notas'),
|
||||||
(u'Radar', u'http://www.pagina12.com.ar/diario/rss/radar.xml'),
|
(u'Radar libros' , u'https://www.pagina12.com.ar/rss/suplementos/radar-libros/notas'),
|
||||||
(u'Radar libros', u'http://www.pagina12.com.ar/diario/rss/libros.xml'),
|
(u'Cash' , u'https://www.pagina12.com.ar/rss/suplementos/cash/notas'),
|
||||||
(u'Cash', u'http://www.pagina12.com.ar/diario/rss/cash.xml'),
|
(u'Turismo' , u'https://www.pagina12.com.ar/rss/suplementos/turismo/notas'),
|
||||||
(u'Turismo', u'http://www.pagina12.com.ar/diario/rss/turismo.xml'),
|
(u'Libero' , u'https://www.pagina12.com.ar/rss/suplementos/libero/notas'),
|
||||||
(u'Libero', u'http://www.pagina12.com.ar/diario/rss/libero.xml'),
|
(u'NO' , u'https://www.pagina12.com.ar/rss/suplementos/no/notas'),
|
||||||
(u'NO', u'http://www.pagina12.com.ar/diario/rss/no.xml'),
|
(u'Las/12' , u'https://www.pagina12.com.ar/rss/suplementos/las12/notas'),
|
||||||
(u'Las/12', u'http://www.pagina12.com.ar/diario/rss/las12.xml'),
|
(u'Soy' , u'https://www.pagina12.com.ar/rss/suplementos/soy/notas'),
|
||||||
(u'Soy', u'http://www.pagina12.com.ar/diario/rss/soy.xml'),
|
|
||||||
(u'Futuro' , u'http://www.pagina12.com.ar/diario/rss/futuro.xml'),
|
(u'Futuro' , u'http://www.pagina12.com.ar/diario/rss/futuro.xml'),
|
||||||
(u'M2', u'http://www.pagina12.com.ar/diario/rss/m2.xml'),
|
(u'M2' , u'https://www.pagina12.com.ar/rss/suplementos/m2/notas'),
|
||||||
(u'Rosario/12', u'http://www.pagina12.com.ar/diario/rss/rosario.xml')
|
(u'Rosario/12' , u'https://www.pagina12.com.ar/rss/suplementos/rosario12/notas')
|
||||||
]
|
]
|
||||||
|
|
||||||
def print_version(self, url):
|
def get_article_url(self, article):
|
||||||
return url.replace('http://www.pagina12.com.ar/', 'http://www.pagina12.com.ar/imprimir/')
|
url = article.get('guid', None)
|
||||||
|
if url.startswith('/'):
|
||||||
|
return self.PREFIX + url
|
||||||
|
return url
|
||||||
|
|
||||||
def get_cover_url(self):
|
def get_cover_url(self):
|
||||||
soup = self.index_to_soup(
|
soup = self.index_to_soup(self.PREFIX)
|
||||||
'http://www.pagina12.com.ar/diario/principal/diario/index.html')
|
|
||||||
for image in soup.findAll('img', alt=True):
|
for image in soup.findAll('img', alt=True):
|
||||||
if image['alt'].startswith('Tapa de la fecha'):
|
if image['alt'].startswith('Tapa del dia'):
|
||||||
return image['src']
|
return self.PREFIX + image['data-src']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
|
||||||
for item in soup.findAll(style=True):
|
|
||||||
del item['style']
|
|
||||||
for item in soup.findAll('span', attrs={'id': 'seccion'}):
|
|
||||||
it = item.a
|
|
||||||
it.name = 'span'
|
|
||||||
del it['href']
|
|
||||||
del it['title']
|
|
||||||
for item in soup.findAll('p'):
|
|
||||||
it = item.find('h3')
|
|
||||||
if it:
|
|
||||||
it.name = 'span'
|
|
||||||
return soup
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user