Debian Codegraph @

recipes/marca.recipe

raw
1 # -*- coding: utf-8 -*-
2 __license__ = 'GPL v3'
3 __copyright__ = '2009-2011, Darko Miletic <darko.miletic at gmail.com>'
4 '''
5 www.marca.com
6 '''
7
8 from calibre.web.feeds.news import BasicNewsRecipe
9
10
11 class Marca(BasicNewsRecipe):
12 title = 'Marca'
13 __author__ = 'Darko Miletic'
14 description = 'Noticias deportivas'
15 publisher = 'marca.com'
16 category = 'news, sports, Spain'
17 oldest_article = 2
18 max_articles_per_feed = 100
19 no_stylesheets = True
20 use_embedded_content = False
21 delay = 1
22 encoding = 'iso-8859-15'
23 language = 'es'
24 publication_type = 'newsportal'
25 masthead_url = 'http://estaticos.marca.com/deporte/img/v3.0/img_marca-com.png'
26 extra_css = '''
27 body{font-family: Tahoma,Geneva,sans-serif}
28 h1,h2,h3,h4,h5,h6{font-family: 'LatoBlack',Tahoma,Geneva,sans-serif}
29 .cab_articulo h4 {font-family: Georgia,"Times New Roman",Times,serif}
30 .antetitulo{text-transform: uppercase}
31 '''
32
33 feeds = [('Portada', 'http://estaticos.marca.com/rss/portada.xml')]
34
35 keep_only_tags = [dict(name='div', attrs={'class': ['cab_articulo', 'cuerpo_articulo']})]
36 remove_attributes = ['lang']
37 remove_tags = [dict(name=['object', 'link', 'script', 'embed', 'iframe', 'meta', 'base']), dict(name='div', attrs={'class': 'tabs'})]
38
39 def preprocess_html(self, soup):
40 for item in soup.findAll(style=True):
41 del item['style']
42 return soup
43
44 def get_article_url(self, article):
45 return article.get('guid', None)