#!/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 TrvScience(BasicNewsRecipe):
    title = '\u0422\u0440\u043e\u0438\u0446\u043a\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442'
    language = 'ru'
    __author__ = 'Vadim Dyadkin (with fixes by bugmen00t)'
    oldest_article = 30
    max_articles_per_feed = 100
    recursion = 4
    no_stylesheets = True
    simultaneous_downloads = 1
    #    cover_url = 'https://i0.wp.com/trv-science.ru/uploads/logo_trv2-e1573805568596-1.png'
    cover_url = 'https://i0.wp.com/trv-science.ru/uploads/cropped-trv_neur-1024.png'

    remove_tags_before = dict(name='main', attrs={'id': 'main'})

    remove_tags_after = dict(name='div', attrs={'class': 'wpdiscuz-comment-pagination'})

    remove_tags = [
        dict(name='span', attrs={'class': 'fa fa-user'}),
        dict(name='h4'),
        dict(name='svg'),
        dict(name='ul', attrs={'class': 'st-related-posts'}),
        dict(name='footer', attrs={'class': 'entry-meta'}),
        #        dict(name='div', attrs={'id': 'comments'}),
        dict(name='div', attrs={'class': 'wpd-vote'}),
        dict(name='div', attrs={'class': 'mistape_caption'}),
        dict(name='div', attrs={'class': 'wpd-comment-share wpd-hidden wpd-tooltip wpd-top'}),
        dict(name='div', attrs={'class': 'wpd-comment-left '}),
        dict(name='div', attrs={'class': 'wpd-space'}),
        dict(name='div', attrs={'class': 'wpd-reply-button'}),
        dict(name='div', attrs={'class': 'wpd-comment-link wpd-hidden'}),
        dict(name='div', attrs={'class': 'wpd-comment-last-edited'}),
        dict(name='div', attrs={'class': 'wpd-comment-date'}),
        dict(name='div', attrs={'class': 'wpd-comment-info-bar'}),
        dict(name='div', attrs={'class': 'wpd-form-wrap'}),
    ]

    feeds = [('\u0422\u0440\u043e\u0438\u0446\u043a\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442', 'https://trv-science.ru/feed/')]
