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

from calibre.web.feeds.news import BasicNewsRecipe


class UkrInform(BasicNewsRecipe):
    title = 'UkrInform (English)'
    __author__ = 'bugmen00t'
    description = 'State information and news agency of Ukraine.'
    publisher = 'Ministry of Culture and Information Policy of Ukraine'
    category = 'newspaper'
    cover_url = u'https://static.ukrinform.com/photos/2022_05/thumb_files/630_360_1651819943-560.jpg'
    language = 'en_UK'
    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 = [('Latest news', 'https://www.ukrinform.net/rss/block-lastnews'),
             ('War', 'https://www.ukrinform.net/rss/rubric-ato'),
             ('Politics', 'https://www.ukrinform.net/rss/rubric-polytics'),
             ('Economy', 'https://www.ukrinform.net/rss/rubric-economy'),
             ('Defense', 'https://www.ukrinform.net/rss/rubric-defense'),
             ('Society and Culture', 'https://www.ukrinform.net/rss/rubric-society'),
             ('Sports', 'https://www.ukrinform.net/rss/rubric-sports'),
             ('Crime', 'https://www.ukrinform.net/rss/rubric-crime'),
             (
                 'Accidents and Emergencies',
                 'https://www.ukrinform.net/rss/rubric-emergencies'
             )]
