mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Updated recipe for El Universal
This commit is contained in:
parent
b3de4fa7b1
commit
ee3be40500
@ -10,7 +10,7 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
|||||||
|
|
||||||
class ElUniversal(BasicNewsRecipe):
|
class ElUniversal(BasicNewsRecipe):
|
||||||
title = 'El Universal'
|
title = 'El Universal'
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = 'Darko Miletic and Sujata Raman'
|
||||||
description = 'News from Mexico'
|
description = 'News from Mexico'
|
||||||
oldest_article = 1
|
oldest_article = 1
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
@ -22,17 +22,71 @@ class ElUniversal(BasicNewsRecipe):
|
|||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
language = 'es'
|
language = 'es'
|
||||||
|
|
||||||
|
extra_css = '''
|
||||||
|
body{font-family:Arial,Helvetica,sans-serif; font-size:x-small;}
|
||||||
|
.geoGris30{font-family:Georgia,"Times New Roman",Times,serif; font-size:large; color:#003366; font-weight:bold;}
|
||||||
|
.arnegro16{font-family:Georgia,"Times New Roman",Times,serif; font-weight:bold; font-size:small;}
|
||||||
|
.tbazull2{font-family:"trebuchet ms",Arial,Helvetica,sans-serif; color:#336699; font-size:xx-small;}
|
||||||
|
.tbgrisf11{font-family:"trebuchet ms",Arial,Helvetica,sans-serif; color: #666666; font-size:xx-small;}
|
||||||
|
.verrojo13{font-family:"trebuchet ms",Arial,Helvetica,sans-serif; color: #CC0033; font-size:xx-small;}
|
||||||
|
.trnegro13{font-family:"trebuchet ms",Arial,Helvetica,sans-serif; font-size:xx-small;}
|
||||||
|
.txt-fotogaleria{font-family:"trebuchet ms",Arial,Helvetica,sans-serif; font-size:xx-small;}
|
||||||
|
'''
|
||||||
|
keep_only_tags = [ dict(name='table', attrs={'width':"633"}),dict(name='table', attrs={'width':"629"}),]
|
||||||
|
|
||||||
html2lrf_options = [
|
remove_tags = [
|
||||||
'--comment', description
|
dict(name='table', attrs={'bgcolor':"#f5f5f5"}),
|
||||||
, '--category', category
|
dict(name='td', attrs={'bgcolor':"#f7f8f9"}),
|
||||||
, '--publisher', publisher
|
dict(name='td', attrs={'bgcolor':"#f5f5f5"}),
|
||||||
, '--ignore-tables'
|
dict(name='table', attrs={'width':"302"}),
|
||||||
]
|
dict(name='table', attrs={'width':"214"}),
|
||||||
|
dict(name='table', attrs={'width':"112"}),
|
||||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True'
|
dict(name='table', attrs={'width':"980"}),
|
||||||
|
dict(name='td', attrs={'height':"1"}),
|
||||||
remove_tags = [dict(name='link')]
|
dict(name='td', attrs={'height':"4"}),
|
||||||
|
dict(name='td', attrs={'height':"20"}),
|
||||||
|
dict(name='td', attrs={'height':"10"}),
|
||||||
|
dict(name='td', attrs={'class':["trrojo11","trbris11","trrojo12","arrojo12s","tbazul13"]}),
|
||||||
|
dict(name='div', attrs={'id':["mapg","ver_off_todosloscom","todosloscom"]}),
|
||||||
|
dict(name='span', attrs={'class':["trazul18b","trrojo11","trnaranja11","trbris11","georojo18b","geogris18"]}),
|
||||||
|
dict(name='span', attrs={'class':["detalles-opinion"]}),
|
||||||
|
dict(name='a', attrs={'class':["arnaranja12b","trbris11","arazul12rel","trrojo10"]}),
|
||||||
|
dict(name='img', src = "/img/icono_imprimir.gif"),
|
||||||
|
dict(name='img', src = "/img/icono_enviar_mail.gif"),
|
||||||
|
dict(name='img', src = "/img/icono_fuente_g.gif"),
|
||||||
|
dict(name='img', src = "/img/icono_fuente_m.gif"),
|
||||||
|
dict(name='img', src = "/img/icono_fuente_c.gif"),
|
||||||
|
dict(name='img', src = "/img/icono_compartir.gif"),
|
||||||
|
dict(name='img', src = "/img/icono_enviar_coment.gif"),
|
||||||
|
dict(name='img', src = "http://www.eluniversal.com.mx/n_img/bot-notasrel.gif"),
|
||||||
|
dict(name='img', src = "http://www.eluniversal.com.mx/n_img/fr.gif"),
|
||||||
|
dict(name='img', src = "/img/espiral2.gif"),
|
||||||
|
dict(name='img', src = "http://www.eluniversal.com.mx/n_img/b"),
|
||||||
|
dict(name='img', src = "/img/icono_enviar_coment.gifot-notasrel.gif"),
|
||||||
|
dict(name='img', src = "/n_img/icono_tipo3.gif"),
|
||||||
|
dict(name='img', src = "/n_img/icono_tipo2.gif"),
|
||||||
|
dict(name='img', src = "/n_img/icono_print.gif"),
|
||||||
|
dict(name='img', src = "/n_img/icono_mail2.gif"),
|
||||||
|
dict(name='img', src = "/n_img/im-comentarios-2a.gif"),
|
||||||
|
dict(name='img', src = "/n_img/im-comentarios-1a.gif"),
|
||||||
|
dict(name='img', src = "/img/icono_coment.gif"),
|
||||||
|
dict(name='img', src = "http://www.eluniversal.com.mx/n_img/bot-sitiosrel.gif"),
|
||||||
|
dict(name='img', src = "/n_img/icono_tipomenos.gif"),
|
||||||
|
dict(name='img', src = "/img/futbol/19.jpg"),
|
||||||
|
dict(name='img', alt = "Facebook"),
|
||||||
|
dict(name='img', alt = "Twitter"),
|
||||||
|
dict(name='img', alt = "Google"),
|
||||||
|
dict(name='img', alt = "LinkedIn"),
|
||||||
|
dict(name='img', alt = "Viadeo"),
|
||||||
|
dict(name='img', alt = "Digg"),
|
||||||
|
dict(name='img', alt = "Delicious"),
|
||||||
|
dict(name='img', alt = "Meneame"),
|
||||||
|
dict(name='img', alt = "Yahoo"),
|
||||||
|
dict(name='img', alt = "Technorati"),
|
||||||
|
dict(name='a',text =["Compartir","Facebook","Twitter","Google","LinkedIn","Viadeo","Digg","Delicious","Meneame","Yahoo","Technorati"]),
|
||||||
|
dict(name='select'),
|
||||||
|
dict(name='a', attrs={'class':"tbgriscompartir"}),
|
||||||
|
]
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
(u'Minuto por Minuto', u'http://www.eluniversal.com.mx/rss/universalmxm.xml' )
|
(u'Minuto por Minuto', u'http://www.eluniversal.com.mx/rss/universalmxm.xml' )
|
||||||
@ -40,7 +94,7 @@ class ElUniversal(BasicNewsRecipe):
|
|||||||
,(u'Mexico' , u'http://www.eluniversal.com.mx/rss/mexico.xml' )
|
,(u'Mexico' , u'http://www.eluniversal.com.mx/rss/mexico.xml' )
|
||||||
,(u'Estados' , u'http://www.eluniversal.com.mx/rss/estados.xml' )
|
,(u'Estados' , u'http://www.eluniversal.com.mx/rss/estados.xml' )
|
||||||
,(u'Finanzas' , u'http://www.eluniversal.com.mx/rss/finanzas.xml' )
|
,(u'Finanzas' , u'http://www.eluniversal.com.mx/rss/finanzas.xml' )
|
||||||
,(u'Deportes' , u'http://www.eluniversal.com.mx/rss/deportes.xml' )
|
(u'Deportes' , u'http://www.eluniversal.com.mx/rss/deportes.xml' )
|
||||||
,(u'Espectaculos' , u'http://www.eluniversal.com.mx/rss/espectaculos.xml' )
|
,(u'Espectaculos' , u'http://www.eluniversal.com.mx/rss/espectaculos.xml' )
|
||||||
,(u'Cultura' , u'http://www.eluniversal.com.mx/rss/cultura.xml' )
|
,(u'Cultura' , u'http://www.eluniversal.com.mx/rss/cultura.xml' )
|
||||||
,(u'Ciencia' , u'http://www.eluniversal.com.mx/rss/ciencia.xml' )
|
,(u'Ciencia' , u'http://www.eluniversal.com.mx/rss/ciencia.xml' )
|
||||||
@ -48,19 +102,24 @@ class ElUniversal(BasicNewsRecipe):
|
|||||||
,(u'Sociedad' , u'http://www.eluniversal.com.mx/rss/sociedad.xml' )
|
,(u'Sociedad' , u'http://www.eluniversal.com.mx/rss/sociedad.xml' )
|
||||||
]
|
]
|
||||||
|
|
||||||
def print_version(self, url):
|
# def print_version(self, url):
|
||||||
return url.replace('/notas/','/notas/vi_')
|
# return url.replace('/notas/','/notas/vi_')
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
mtag = '<meta http-equiv="Content-Language" content="es-MX"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
|
mtag = '<meta http-equiv="Content-Language" content="es-MX"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
|
||||||
soup.head.insert(0,mtag)
|
soup.head.insert(0,mtag)
|
||||||
for item in soup.findAll(style=True):
|
for tag in soup.findAll(name='td',attrs={'class': 'arazul50'}):
|
||||||
del item['style']
|
tag.insert(0,"<h1>")
|
||||||
for item in soup.findAll(font=True):
|
tag.insert(2,"</h1>")
|
||||||
del item['font']
|
|
||||||
for item in soup.findAll(face=True):
|
return soup
|
||||||
del item['face']
|
|
||||||
for item in soup.findAll(helvetica=True):
|
def postprocess_html(self, soup,first):
|
||||||
del item['helvetica']
|
|
||||||
return soup
|
for tag in soup.findAll(name=['table', 'span','i']):
|
||||||
|
tag.name = 'div'
|
||||||
|
for item in soup.findAll(align = "right"):
|
||||||
|
del item['align']
|
||||||
|
|
||||||
|
return soup
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user