Debian Codegraph @

recipes/ambito.recipe

raw
1 #!/usr/bin/env python
2 # -*- mode: python -*-
3 # -*- coding: utf-8 -*-
4
5 __license__ = 'GPL v3'
6 __copyright__ = '2008-2021, Darko Miletic <darko.miletic at gmail.com>'
7 '''
8 ambito.com
9 '''
10
11 from calibre.web.feeds.news import BasicNewsRecipe, classes
12
13
14 class Ambito(BasicNewsRecipe):
15 title = 'Ambito.com'
16 __author__ = 'Darko Miletic'
17 description = 'Ambito.com con noticias del Diario Ambito Financiero de Buenos Aires'
18 publisher = 'Editorial Nefir S.A.'
19 category = 'news, politics, economy, finances, Argentina'
20 oldest_article = 1.2
21 no_stylesheets = True
22 encoding = 'utf-8'
23 use_embedded_content = False
24 remove_empty_feeds = True
25 compress_news_images = True
26 scale_news_images_to_device = True
27 ignore_duplicate_articles = {'url'}
28 language = 'es_AR'
29 publication_type = 'newsportal'
30 masthead_url = 'https://www.ambito.com/css-custom/239/images/logo-239-2020v2.svg'
31 extra_css = '''
32 body{font-family: Roboto, sans-serif}
33 '''
34
35 conversion_options = {'comment': description, 'tags': category, 'publisher': publisher, 'language': language}
36
37 keep_only_tags = [
38 classes(
39 'detail-highlighted-multimedia news-headline__publication-date news-headline__title news-headline__author-wrapper news-headline__article-summary'
40 ),
41 dict(name='article', attrs={'class': lambda x: x and 'article-body' in x.split()}),
42 ]
43 remove_tags = [dict(name=['object', 'link', 'embed', 'iframe', 'meta', 'link'])]
44
45 feeds = [
46 ('Portada', 'https://www.ambito.com/rss/home.xml'),
47 ('Economia', 'https://www.ambito.com/rss/economia.xml'),
48 ('Finanzas', 'https://www.ambito.com/rss/finanzas.xml'),
49 ('Politica', 'https://www.ambito.com/rss/politica.xml'),
50 ('Opinion', 'https://www.ambito.com/rss/opinion.xml'),
51 ('Informacion General', 'https://www.ambito.com/rss/informacion-general.xml'),
52 ('Mundo', 'https://www.ambito.com/rss/mundo.xml'),
53 ('Deportes', 'https://www.ambito.com/rss/deportes.xml'),
54 ('Espectaculos', 'https://www.ambito.com/rss/espectaculos.xml'),
55 ('Nacional', 'https://www.ambito.com/rss/nacional.xml'),
56 ]
57
58 def preprocess_html(self, soup):
59 for img in soup.findAll('img', attrs={'data-td-src-property': True}):
60 img['src'] = img['data-td-src-property']
61 return soup