# -*- mode: python -*-
# -*- coding: utf-8 -*-

__license__   = 'GPL v3'
__copyright__ = '2008-2016, Darko Miletic <darko.miletic at gmail.com>'
'''
ambito.com
'''

from calibre.web.feeds.news import BasicNewsRecipe


class Ambito(BasicNewsRecipe):
    title                 = 'Ambito.com'
    __author__            = 'Darko Miletic'
    description           = 'Ambito.com con noticias del Diario Ambito Financiero de Buenos Aires'
    publisher             = 'Editorial Nefir S.A.'
    category              = 'news, politics, economy, finances, Argentina'
    oldest_article        = 2
    no_stylesheets        = True
    encoding              = 'utf8'
    use_embedded_content  = False
    remove_empty_feeds    = True
    ignore_duplicate_articles = {'url'}
    language              = 'es_AR'
    publication_type      = 'newsportal'
    extra_css             = """
                                body{font-family: Roboto, sans-serif}
                            """

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

    keep_only_tags    = [
                          dict(name='h6', attrs={'class': lambda x: x and 'bajada' in x.split()})
                          ,dict(name='span', attrs={'class': lambda x: x and 'dia' in x.split()})
                          ,dict(attrs={'class': lambda x: x and 'titulo-noticia' in x.split()})
                          ,dict(attrs={'class': lambda x: x and 'despliegue-noticia' in x.split()})
                        ]
    remove_tags       = [dict(name=['object','link','embed','iframe','meta','link'])]

    feeds = [
             (u'Principales Noticias', u'http://www.ambito.com/rss/noticiasp.asp')
             ,(u'Economia'            , u'http://www.ambito.com/rss/noticias.asp?S=Econom%EDa')
             ,(u'Politica'            , u'http://www.ambito.com/rss/noticias.asp?S=Pol%EDtica')
             ,(u'Informacion General' , u'http://www.ambito.com/rss/noticias.asp?S=Informaci%F3n%20General')
             ,(u'Campo'               , u'http://www.ambito.com/rss/noticias.asp?S=Agro')
             ,(u'Internacionales'     , u'http://www.ambito.com/rss/noticias.asp?S=Internacionales')
             ,(u'Deportes'            , u'http://www.ambito.com/rss/noticias.asp?S=Deportes')
             ,(u'Espectaculos'        , u'http://www.ambito.com/rss/noticias.asp?S=Espect%E1culos')
             ,(u'Tecnologia'          , u'http://www.ambito.com/rss/noticias.asp?S=Tecnolog%EDa')
             ,(u'Ambito Nacional'     , u'http://www.ambito.com/rss/noticias.asp?S=Ambito%20Nacional')
            ]
