#!/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: E501
    publisher = 'Ministerio de Cultura y Pol\u00edtica de Informaci\u00f3n de Ucrania'
    category = 'newspaper'
    cover_url = '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'),
    ]
