#!/usr/pkg/bin/python3.13
# -*- coding: utf-8 -*-

__license__ = 'GPL v3'
__copyright__ = u'2011, Silviu Cotoar\u0103'
'''
adevarul.ro
'''

from calibre.web.feeds.news import BasicNewsRecipe


class Adevarul(BasicNewsRecipe):
    title = u'Adev\u0103rul'
    language = 'ro'
    __author__ = u'Silviu Cotoar\u0103'
    description = u'\u0218tiri din Rom\u00e2nia'
    publisher = 'Adevarul'
    category = 'Ziare,Stiri,Romania'
    oldest_article = 5
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    encoding = 'utf-8'
    remove_javascript = True
    cover_url = 'http://upload.wikimedia.org/wikipedia/en/d/d6/Logo_noul_adevarul.png'

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

    keep_only_tags = [dict(name='div', attrs={'class': 'article_header'}), dict(name='div', attrs={'class': 'bb-tu first-t bb-article-body'})
                      ]

    remove_tags = [
        dict(name='li', attrs={'class': 'author'}), dict(name='li', attrs={'class': 'date'}), dict(name='li', attrs={'class': 'comments'}), dict(name='div', attrs={'class': 'bb-wg-article_related_attachements'}), dict(name='div', attrs={'class': 'bb-md bb-md-article_comments'}), dict(name='form', attrs={'id': 'bb-comment-create-form'}), dict(name='div', attrs={'id': 'mediatag'}), dict(name='div', attrs={'id': 'ft'}), dict(name='div', attrs={'id': 'comment_wrapper'})  # noqa
    ]

    remove_tags_after = [
        dict(name='div', attrs={'id': 'comment_wrapper'}),
    ]

    feeds = [(u'\u0218tiri', u'http://www.adevarul.ro/rss/latest')]

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