#!/usr/bin/env python
# vim:fileencoding=utf-8

from calibre.web.feeds.news import BasicNewsRecipe


class UkrInform(BasicNewsRecipe):
    title                 = 'UkrInform (Espa\u00F1ol)'
    __author__            = 'bugmen00t'
    description           = 'Agencia de noticias nacional de Ucrania, fuente de informaci\u00F3n sobre la vida pol\u00EDtica, econ\u00F3mica, social, cient\u00EDfica, cultural y p\u00FAblica en Ucrania y en el extranjero.'  # noqa
    publisher             = 'Ministerio de Cultura y Pol\u00EDtica de Informaci\u00F3n de Ucrania'
    category              = 'newspaper'
    cover_url = u'https://static.ukrinform.com/photos/2022_05/thumb_files/630_360_1651819943-560.jpg'
    language              = 'es'
    no_stylesheets        = True
    remove_javascript = False
    auto_cleanup   = False
    oldest_article = 7
    max_articles_per_feed = 30

    remove_tags_before = dict(name='article')

    remove_tags_after = dict(name='article')

    remove_tags =   [
        dict(name='aside'),
        dict(name='img', attrs={'class': 'pixel'}),
        dict(name='section', attrs={'class': 'read'}),
        dict(name='div', attrs={'data-name': 'int_hidden'})
        ]

    feeds = [
        ('\u00DAltimas noticias', 'https://www.ukrinform.es/rss/block-lastnews'),
        ('Guerra', 'https://www.ukrinform.es/rss/rubric-ato'),
        ('Pol\u00EDtica', 'https://www.ukrinform.es/rss/rubric-polytics'),
        ('Econom\u00EDa', 'https://www.ukrinform.es/rss/rubric-economy'),
        ('Defensa', 'https://www.ukrinform.es/rss/rubric-defense'),
        ('Sociedad y Cultura', 'https://www.ukrinform.es/rss/rubric-society'),
        ('Deportes', 'https://www.ukrinform.es/rss/rubric-sports'),
        ('Crimen', 'https://www.ukrinform.es/rss/rubric-crime'),
        ('Desastres y emergencias', 'https://www.ukrinform.es/rss/rubric-emergencies')
    ]
