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

from __future__ import absolute_import, division, print_function, unicode_literals

from calibre.web.feeds.news import BasicNewsRecipe


class PravdaUAUA(BasicNewsRecipe):
    title = '\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430 \u043F\u0440\u0430\u0432\u0434\u0430'
    __author__ = 'bugmen00t'
    description = '\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0435 \u0441\u0443\u0441\u043F\u0456\u043B\u044C\u043D\u043E-\u043F\u043E\u043B\u0456\u0442\u0438\u0447\u043D\u0435 \u0456\u043D\u0442\u0435\u0440\u043D\u0435\u0442-\u0417\u041C\u0406'  # noqa
    publisher = 'pravda.com.ua'
    category = 'newspaper'
    cover_url = u'https://img.pravda.com/images/up_for_fb.gif'
    language = 'uk'
    no_stylesheets = False
    remove_javascript = False
    auto_cleanup = False
    oldest_article = 7
    max_articles_per_feed = 30

    remove_tags_before = dict(name='h1')

    remove_tags_after = dict(name='article', attrs={'class': 'post'})

    remove_tags = [
        dict(name='footer'),
        dict(name='div', attrs={'class': 'nts-video-wrapper'}),
        dict(name='div', attrs={'class': 'post-report'}),
        dict(name='div', attrs={'class': 'post__report'}),
        dict(name='div', attrs={'class': 'social_item'}),
        dict(name='div', attrs={'class': 'sidebar'}),
        dict(
            name='div',
            attrs={
                'class':
                'article-announcement-photo article-announcement-photo-block-1'
            }
        ),
        dict(
            name='div',
            attrs={'class': 'statistic-bottom-block statistic-top-block'}
        ),
        dict(name='div', attrs={'class': 'modal modal_search modal_white'}),
        dict(name='div', attrs={'class': 'modal_auth modal_white'}),
        dict(name='div', attrs={'class': 'main_logo'}),
        dict(name='div', attrs={'class': 'footer_banner'}),
        dict(name='nav', attrs={'class': 'block block_menu'}),
        dict(name='div', attrs={'class': 'pagewrap page-point'}),
        dict(name='div', attrs={'class': 'modal fade search-popup'}),
        dict(name='div', attrs={'data-vr-zone': 'Mobile main menu'}),
        dict(name='aside'),
        dict(name='div', attrs={'class': 'block_related'}),
        dict(name='div', attrs={'class': 'block_comments'}),
        dict(name='div', attrs={'class': 'post_tags'}),
        dict(name='div', attrs={'class': 'post__tags'})
    ]

    feeds = [
        (
            '\u0412\u0441\u0456 \u043C\u0430\u0442\u0435\u0440\u0456\u0430\u043B\u0438',
            'https://www.pravda.com.ua/rss/'
        ),
        (
            '\u041D\u0430\u0439\u0432\u0430\u0436\u043B\u0438\u0432\u0456\u0448\u0456 \u043D\u043E\u0432\u0438\u043D\u0438',
            'https://www.pravda.com.ua/rss/view_mainnews/'
        ),
        (
            '\u041D\u043E\u0432\u0438\u043D\u0438',
            'https://www.pravda.com.ua/rss/view_news/'
        ),
        (
            '\u041F\u0443\u0431\u043B\u0456\u043A\u0430\u0446\u0456\u0457',
            'https://www.pravda.com.ua/rss/view_pubs/'
        ),
    ]
