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

from calibre.web.feeds.news import BasicNewsRecipe


class UAFootball(BasicNewsRecipe):

#Russian version
#    title = 'UA-\u0424\u0443\u0442\u0431\u043E\u043B'
#    language = 'ru_UK'
#    feeds = [
#        ('\u041D\u043E\u0432\u043E\u0441\u0442\u0438 \u0444\u0443\u0442\u0431\u043E\u043B\u0430', 'https://www.ua-football.com/rss/all.xml')
#        ]

#Ukrainian version
    title = 'UA-\u0424\u0443\u0442\u0431\u043E\u043B'
    description = ('\u0410\u043A\u0442\u0443\u0430\u043B\u044C\u043D\u0456 \u0442\u0435\u043C\u0438'
                   ' \u0444\u0443\u0442\u0431\u043E\u043B\u044C\u043D\u043E\u0433\u043E'
                   ' \u0436\u0438\u0442\u0442\u044F \u0423\u043A\u0440\u0430\u0457\u043D\u0438 \u0442\u0430'
                   ' \u0432\u0441\u044C\u043E\u0433\u043E \u0441\u0432\u0456\u0442\u0443.')
    language = 'uk'
    feeds = [
        ('\u041D\u043E\u0432\u0438\u043D\u0438', 'https://www.ua-football.com/ua/rss/all.xml')
        ]

    __author__ = 'bugmen00t'
    publisher = '1766 TEAM EOOD'
    category = 'news'
    cover_url = u'https://yt3.googleusercontent.com/11FSvKeWcjFhzKrO7nXZdc-I__UeZ0mhZwbwyOHtnx_1-q6d0zQ2LbOt2duNCY06JVg2cGXS-g=s900-c-k-c0x00ffffff-no-rj'
    no_stylesheets = False
    remove_javascript = False
    auto_cleanup = False
    remove_empty_feeds = True
    oldest_article = 7
    max_articles_per_feed = 200

    remove_tags_before = dict(name='h1')

    remove_tags_after = dict(name='div', attrs={'class': 'show-post'})

    remove_tags =   [
         dict(name='form'),
         dict(name='iframe'),
         dict(name='div', attrs={'class': 'language'}),
         dict(name='div', attrs={'class': 'article__read-also'}),
         dict(name='div', attrs={'class': 'card-player'}),
         dict(name='div', attrs={'class': 'show-post-socials'})
         ]

# Replacing articles in Ukraininan for RU-feed
#    def print_version(self, url):
#        return url.replace('ua-football.com/ua/', 'ua-football.com/')
