#!/usr/pkg/bin/python3.13
# -*- mode: python -*-
# -*- coding: utf-8 -*-

__license__ = 'GPL v3'
__copyright__ = '2008-2021, Darko Miletic <darko.miletic at gmail.com>'
'''
ambito.com
'''

from calibre.web.feeds.news import BasicNewsRecipe


class Ambito(BasicNewsRecipe):
    title = 'Ambito.com'
    __author__ = 'Darko Miletic'
    description = 'Ambito.com con noticias del Diario Ambito Financiero de Buenos Aires'
    publisher = 'Editorial Nefir S.A.'
    category = 'news, politics, economy, finances, Argentina'
    oldest_article = 2
    no_stylesheets = True
    encoding = 'utf8'
    use_embedded_content = False
    remove_empty_feeds = True
    handle_gzip = True
    compress_news_images = True
    scale_news_images_to_device = True
    ignore_duplicate_articles = {'url'}
    language = 'es_AR'
    publication_type = 'newsportal'
    masthead_url = 'https://www.ambito.com/css-custom/239/images/logo-239-2020v2.svg'
    extra_css = """
        body{font-family: Roboto, sans-serif}
    """

    conversion_options = {
        'comment': description,
        'tags': category,
        'publisher': publisher,
        'language': language
    }

    keep_only_tags = [
        dict(name='div', attrs={'class': 'detail-header-wrapper'}),
        dict(attrs={'class': lambda x: x and 'detail-body' in x.split()}),
    ]
    remove_tags = [
        dict(name=['object', 'link', 'embed', 'iframe', 'meta', 'link', 'img'])
    ]

    feeds = [
        (u'Portada', u'https://www.ambito.com/rss/home.xml'),
        (u'Economia', u'https://www.ambito.com/rss/economia.xml'),
        (u'Finanzas', u'https://www.ambito.com/rss/finanzas.xml'),
        (u'Politica', u'https://www.ambito.com/rss/politica.xml'),
        (u'Opinion', u'https://www.ambito.com/rss/opinion.xml'),
        (u'Informacion General', u'https://www.ambito.com/rss/informacion-general.xml'),
        (u'Mundo', u'https://www.ambito.com/rss/mundo.xml'),
        (u'Deportes', u'https://www.ambito.com/rss/deportes.xml'),
        (u'Espectaculos', u'https://www.ambito.com/rss/espectaculos.xml'),
        (u'Nacional', u'https://www.ambito.com/rss/nacional.xml')
    ]
