mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #786293 (Updated recipe for Marca website)
This commit is contained in:
parent
d4f79884a4
commit
746b9b1d63
BIN
recipes/icons/marca.png
Normal file
BIN
recipes/icons/marca.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 293 B |
@ -1,14 +1,11 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
__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>'
|
||||||
'''
|
'''
|
||||||
www.marca.com
|
www.marca.com
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import Tag
|
|
||||||
|
|
||||||
class Marca(BasicNewsRecipe):
|
class Marca(BasicNewsRecipe):
|
||||||
title = 'Marca'
|
title = 'Marca'
|
||||||
@ -22,35 +19,30 @@ class Marca(BasicNewsRecipe):
|
|||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
delay = 1
|
delay = 1
|
||||||
encoding = 'iso-8859-15'
|
encoding = 'iso-8859-15'
|
||||||
language = 'es'
|
language = 'es_ES'
|
||||||
|
publication_type = 'newsportal'
|
||||||
|
masthead_url = 'http://estaticos.marca.com/deporte/img/v3.0/img_marca-com.png'
|
||||||
|
extra_css = """
|
||||||
|
body{font-family: Tahoma,Geneva,sans-serif}
|
||||||
|
h1,h2,h3,h4,h5,h6{font-family: 'LatoBlack',Tahoma,Geneva,sans-serif}
|
||||||
|
.cab_articulo h4 {font-family: Georgia,"Times New Roman",Times,serif}
|
||||||
|
.antetitulo{text-transform: uppercase}
|
||||||
|
"""
|
||||||
|
|
||||||
direction = 'ltr'
|
feeds = [(u'Portada', u'http://estaticos.marca.com/rss/portada.xml')]
|
||||||
|
|
||||||
html2lrf_options = [
|
|
||||||
'--comment' , description
|
|
||||||
, '--category' , category
|
|
||||||
, '--publisher', publisher
|
|
||||||
]
|
|
||||||
|
|
||||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
|
|
||||||
|
|
||||||
feeds = [(u'Portada', u'http://rss.marca.com/rss/descarga.htm?data2=425')]
|
|
||||||
|
|
||||||
keep_only_tags = [dict(name='div', attrs={'class':['cab_articulo','col_izq']})]
|
|
||||||
|
|
||||||
|
keep_only_tags = [dict(name='div', attrs={'class':['cab_articulo','cuerpo_articulo']})]
|
||||||
|
remove_attributes = ['lang']
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['object','link','script'])
|
dict(name=['object','link','script','embed','iframe','meta','base'])
|
||||||
,dict(name='div', attrs={'class':['colC','peu']})
|
,dict(name='div', attrs={'class':'tabs'})
|
||||||
,dict(name='div', attrs={'class':['utilidades estirar','bloque_int_corr estirar']})
|
|
||||||
]
|
]
|
||||||
|
|
||||||
remove_tags_after = [dict(name='div', attrs={'class':'bloque_int_corr estirar'})]
|
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
soup.html['dir' ] = self.direction
|
|
||||||
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
|
|
||||||
soup.head.insert(0,mcharset)
|
|
||||||
for item in soup.findAll(style=True):
|
for item in soup.findAll(style=True):
|
||||||
del item['style']
|
del item['style']
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
|
def get_article_url(self, article):
|
||||||
|
return article.get('guid', None)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user