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

from calibre.web.feeds.news import BasicNewsRecipe


class Fontanka(BasicNewsRecipe):
    title = '\u0424\u043E\u043D\u0442\u0430\u043D\u043A\u0430'
    __author__ = 'bugmen00t'
    description = '\u0415\u0436\u0435\u0434\u043D\u0435\u0432\u043D\u043E\u0435 \u043F\u0435\u0442\u0435\u0440\u0431\u0443\u0440\u0433\u0441\u043A\u043E\u0435 \u043E\u0431\u0449\u0435\u0441\u0442\u0432\u0435\u043D\u043D\u043E-\u043F\u043E\u043B\u0438\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0435 \u0441\u0435\u0442\u0435\u0432\u043E\u0435 \u0438\u0437\u0434\u0430\u043D\u0438\u0435.'  # noqa
    publisher = '\u0410\u041E "\u0410\u0416\u0423\u0420-\u041C\u0415\u0414\u0418\u0410"'
    category = 'blog'
    cover_url = u'https://www.fontanka.ru/longreads/69505589/2015/images/tild3834-3362-4166-b239-366134363733____-01.png'
    language = 'ru'
    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='section', attrs={'itemprop': 'articleBody'})

    remove_tags = [
        dict(name='div', attrs={'class': 'ADdj ADc5'}),
        dict(name='div', attrs={'class': 'DLj1'}),
        dict(name='div', attrs={'class': 'DTrp'}),
        dict(name='div', attrs={'class': 'EHed'}),
        dict(name='div', attrs={'class': 'FHwp'}),
        dict(name='div', attrs={'class': 'ENr-'}),
        dict(name='div', attrs={'class': 'ENt7'}),
        dict(name='div', attrs={'class': 't004'}),
        dict(name='div', attrs={'class': 't120'}),
        dict(name='div', attrs={'class': 't123'}),
        dict(name='div', attrs={'class': 't405'}),
        dict(name='div', attrs={'class': 't463'}),
        # For articles from https://doctorpiter.ru
        dict(
            name='div', attrs={'class': 'article__block article__block_type-links'}
        ),
        dict(name='div', attrs={'class': 'feedback-request-form__before'}),
        dict(name='div', attrs={'class': 'related-entities-container'}),
        dict(name='div', attrs={'class': 'tags article-footer__tags'}),
        dict(name='hr', attrs={'class': 'article-footer-divider'})
    ]

    feeds = [('Fontanka.ru', 'https://www.fontanka.ru/fontanka.rss')]
