#!/usr/bin/env python
# -*- coding: utf-8 -*-

__license__ = 'GPL v3'
__copyright__ = '2011, Silviu Cotoar\u0103'
'''
financiarul.com
'''

from calibre.web.feeds.news import BasicNewsRecipe


class Financiarul(BasicNewsRecipe):
    title = 'Financiarul'
    __author__ = 'Silviu Cotoar\u0103'
    description = 'FIN.ro'
    publisher = 'Financiarul'
    oldest_article = 25
    language = 'ro'
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    category = 'Ziare,Stiri'
    encoding = 'utf-8'
    cover_url = 'http://www.financiarul.com/templates/default/images/logo.png'

    conversion_options = {'comments': description, 'tags': category, 'language': language, 'publisher': publisher}

    keep_only_tags = [dict(name='div', attrs={'class': 'col2ContentLeftL'})]

    remove_tags = [
        dict(name='div', attrs={'class': ['infoArticol']}),
        dict(name='ul', attrs={'class': 'navSectiuni'}),
        dict(name='div', attrs={'class': 'separator separatorTop'}),
        dict(name='div', attrs={'class': 'infoArticol infoArticolBottom'}),
        dict(name='ul', attrs={'class': ['related']}),
        dict(name='div', attrs={'class': ['slot panel300 panelGri300 panelGri300s panelGri300sm']}),  # noqa: E501
    ]

    remove_tags_after = [dict(name='ul', attrs={'class': ['related']})]

    feeds = [('Feeds', 'http://www.financiarul.com/rss')]

    def preprocess_html(self, soup):
        return self.adeify_images(soup)
