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

__license__ = 'GPL v3'
__copyright__ = '2009-2016, Darko Miletic <darko.miletic at gmail.com>'
'''
www.diariobae.com
'''
from calibre.web.feeds.news import BasicNewsRecipe


class BsAsEconomico(BasicNewsRecipe):
    title = 'Buenos Aires Economico'
    __author__ = 'Darko Miletic'
    description = 'Diario BAE es el diario economico-politico con mas influencia en la Argentina. Fuente de empresarios y politicos del pais y el exterior. El pozo estaria aportando en periodos breves un volumen equivalente a 800m3 diarios. Pero todavia deben efectuarse otras perforaciones adicionales.'  # noqa
    publisher = 'Diario BAE'
    category = 'news, politics, economy, Argentina'
    oldest_article = 2
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    encoding = 'utf-8'
    language = 'es_AR'
    masthead_url = 'http://static.cronica.com.ar/FileAccessHandler.ashx?code=635959869637084622'
    remove_empty_feeds = True
    publication_type = 'newspaper'
    extra_css             = """
                               body{font-family: Georgia,"Times New Roman",Times,serif}
                               img{display: block; margin-top: 1em}
                            """
    conversion_options = {
        'comment'  : description,
        'tags'     : category,
        'publisher': publisher,
        'language' : language
    }

    keep_only_tags = [dict(name='div', attrs={'class':'post'})]
    remove_tags = [
                    dict(name=['meta', 'base', 'iframe', 'link', 'lang'])
                    ,dict(attrs={'class':'pdfprnt-bottom-right'})
                  ]

    feeds = [(u'Articles', u'http://www.diariobae.com/feed/getfeed')]

    def get_cover_url(self):
        cover = None
        soup = self.index_to_soup('http://www.diariobae.com/')
        tag = soup.find('a', rel='lightbox[tapa]', href=True)
        if tag:
            cover = tag['href']
        return cover
