mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #803544 (Updated recipe for Buenos Aires Economico)
This commit is contained in:
parent
9c8a7db894
commit
d14db5cda7
@ -1,72 +1,60 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2009-2011, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
elargentino.com
|
www.diariobae.com
|
||||||
'''
|
'''
|
||||||
|
from calibre import strftime
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import Tag
|
from calibre.ebooks.BeautifulSoup import Tag
|
||||||
|
|
||||||
class BsAsEconomico(BasicNewsRecipe):
|
class BsAsEconomico(BasicNewsRecipe):
|
||||||
title = 'Buenos Aires Economico'
|
title = 'Buenos Aires Economico'
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = 'Darko Miletic'
|
||||||
description = 'Revista Argentina'
|
description = 'Diario BAE es el diario economico-politico con mas influencia en la Argentina. Fuente de empresarios y politicos del pais y el exterior. El pozo estaria aportando en periodos breves un volumen equivalente a 800m3 diarios. Pero todavia deben efectuarse otras perforaciones adicionales.'
|
||||||
publisher = 'ElArgentino.com'
|
publisher = 'Diario BAE'
|
||||||
category = 'news, politics, economy, Argentina'
|
category = 'news, politics, economy, Argentina'
|
||||||
oldest_article = 2
|
oldest_article = 2
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
language = 'es_AR'
|
language = 'es_AR'
|
||||||
|
cover_url = strftime('http://www.diariobae.com/imgs_portadas/%Y%m%d_portadasBAE.jpg')
|
||||||
|
masthead_url = 'http://www.diariobae.com/img/logo_bae.png'
|
||||||
|
remove_empty_feeds = True
|
||||||
|
publication_type = 'newspaper'
|
||||||
|
extra_css = """
|
||||||
|
body{font-family: Georgia,"Times New Roman",Times,serif}
|
||||||
|
#titulo{font-size: x-large}
|
||||||
|
#epi{font-size: small; font-style: italic; font-weight: bold}
|
||||||
|
img{display: block; margin-top: 1em}
|
||||||
|
"""
|
||||||
|
conversion_options = {
|
||||||
|
'comment' : description
|
||||||
|
, 'tags' : category
|
||||||
|
, 'publisher' : publisher
|
||||||
|
, 'language' : language
|
||||||
|
}
|
||||||
|
|
||||||
lang = 'es-AR'
|
remove_tags_before= dict(attrs={'id':'titulo'})
|
||||||
direction = 'ltr'
|
remove_tags_after = dict(attrs={'id':'autor' })
|
||||||
INDEX = 'http://www.elargentino.com/medios/121/Buenos-Aires-Economico.html'
|
remove_tags = [
|
||||||
extra_css = ' .titulo{font-size: x-large; font-weight: bold} .volantaImp{font-size: small; font-weight: bold} '
|
dict(name=['meta','base','iframe','link','lang'])
|
||||||
|
,dict(attrs={'id':'barra_tw'})
|
||||||
html2lrf_options = [
|
|
||||||
'--comment' , description
|
|
||||||
, '--category' , category
|
|
||||||
, '--publisher', publisher
|
|
||||||
]
|
]
|
||||||
|
remove_attributes = ['data-count','data-via']
|
||||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\noverride_css=" p {text-indent: 0cm; margin-top: 0em; margin-bottom: 0.5em} "'
|
|
||||||
|
feeds = [
|
||||||
keep_only_tags = [dict(name='div', attrs={'class':'ContainerPop'})]
|
(u'Argentina' , u'http://www.diariobae.com/rss/argentina.xml' )
|
||||||
|
,(u'Valores' , u'http://www.diariobae.com/rss/valores.xml' )
|
||||||
remove_tags = [dict(name='link')]
|
,(u'Finanzas' , u'http://www.diariobae.com/rss/finanzas.xml' )
|
||||||
|
,(u'Negocios' , u'http://www.diariobae.com/rss/negocios.xml' )
|
||||||
feeds = [(u'Articulos', u'http://www.elargentino.com/Highlights.aspx?ParentType=Section&ParentId=121&Content-Type=text/xml&ChannelDesc=Buenos%20Aires%20Econ%C3%B3mico')]
|
,(u'Mundo' , u'http://www.diariobae.com/rss/mundo.xml' )
|
||||||
|
,(u'5 dias' , u'http://www.diariobae.com/rss/5dias.xml' )
|
||||||
def print_version(self, url):
|
,(u'Espectaculos', u'http://www.diariobae.com/rss/espectaculos.xml')
|
||||||
main, sep, article_part = url.partition('/nota-')
|
]
|
||||||
article_id, rsep, rrest = article_part.partition('-')
|
|
||||||
return u'http://www.elargentino.com/Impresion.aspx?Id=' + article_id
|
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
for item in soup.findAll(style=True):
|
for item in soup.findAll(style=True):
|
||||||
del item['style']
|
del item['style']
|
||||||
soup.html['lang'] = self.lang
|
|
||||||
soup.html['dir' ] = self.direction
|
|
||||||
mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
|
|
||||||
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
|
|
||||||
soup.head.insert(0,mlang)
|
|
||||||
soup.head.insert(1,mcharset)
|
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
def get_cover_url(self):
|
|
||||||
cover_url = None
|
|
||||||
soup = self.index_to_soup(self.INDEX)
|
|
||||||
cover_item = soup.find('div',attrs={'class':'colder'})
|
|
||||||
if cover_item:
|
|
||||||
clean_url = self.image_url_processor(None,cover_item.div.img['src'])
|
|
||||||
cover_url = 'http://www.elargentino.com' + clean_url + '&height=600'
|
|
||||||
return cover_url
|
|
||||||
|
|
||||||
def image_url_processor(self, baseurl, url):
|
|
||||||
base, sep, rest = url.rpartition('?Id=')
|
|
||||||
img, sep2, rrest = rest.partition('&')
|
|
||||||
return base + sep + img
|
|
||||||
|
BIN
recipes/icons/buenosaireseconomico.png
Normal file
BIN
recipes/icons/buenosaireseconomico.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 400 B |
Loading…
x
Reference in New Issue
Block a user