Debian Codegraph @

recipes/diario_sport.recipe

raw
1 from calibre.web.feeds.news import BasicNewsRecipe
2
3
4 class DiarioSport(BasicNewsRecipe):
5 title = 'Diario Sport'
6 oldest_article = 2
7 max_articles_per_feed = 75
8 __author__ = 'Jefferson Frantz'
9 description = 'Todas las noticias del Barça y del mundo del deporte en general'
10 timefmt = ' [%d %b, %Y]'
11 language = 'es'
12 no_stylesheets = True
13
14 feeds = [('Sport', 'http://feeds.feedburner.com/sport/ultimahora')]
15
16 extra_css = '''
17 h2{font-family: serif; font-size: small; font-weight: bold; color: #000000; text-align: justify}
18 '''
19
20 keep_only_tags = [dict(name='div', attrs={'id': ['noticiasMedio']})]
21
22 remove_tags = [
23 dict(name=['object', 'link', 'script', 'ul']),
24 dict(
25 name='div',
26 attrs={
27 'id': [
28 'scrAdSense',
29 'herramientas2',
30 'participacion',
31 'participacion2',
32 'bloque1resultados',
33 'bloque2resultados',
34 'cont_vinyetesAnt',
35 'tinta',
36 'noticiasSuperior',
37 'cintillopublicidad2',
38 ]
39 },
40 ),
41 dict(name='p', attrs={'class': ['masinformacion', 'hora']}),
42 dict(name='a', attrs={'class': ["'link'"]}),
43 dict(name='div', attrs={'class': ['addthis_toolbox addthis_default_style', 'firma', 'pretitularnoticia']}),
44 dict(name='form', attrs={'id': ['formularioDeBusquedaAvanzada']}), # noqa: E501
45 ]
46
47 def preprocess_html(self, soup):
48 for item in soup.findAll(style=True):
49 del item['style']
50 return soup
51
52 def postprocess_html(self, soup, first_fetch):
53 img = soup.find('img', src='/img/videos/mascaravideo.png')
54 if img is not None:
55 img.extract()
56
57 return soup