__license__ = 'GPL v3'
__author__ = 'Luis Hernandez'
__copyright__ = 'Luis Hernandez<tolyluis@gmail.com>'
__version__ = 'v1.2'
__date__ = '31 January 2011'

'''
http://www.cincodias.com/
'''

from calibre.web.feeds.news import BasicNewsRecipe


class AdvancedUserRecipe1294946868(BasicNewsRecipe):

    title = u'Cinco Dias'
    publisher = u'Grupo Prisa'

    __author__ = 'Luis Hernandez'
    description = 'spanish web about money and bussiness, free edition'

    cover_url = 'http://www.prisa.com/images/logos/logo_cinco_dias.gif'
    oldest_article = 2
    max_articles_per_feed = 100

    remove_javascript = True
    no_stylesheets = True
    use_embedded_content = False

    language = 'es'
    remove_empty_feeds = True
    encoding = 'ISO-8859-1'
    timefmt = '[%a, %d %b, %Y]'

    keep_only_tags = [
        dict(name='div', attrs={'class': ['cab_articulo cab_noticia', 'pos_3', 'txt_noticia', 'mod_despiece']}), dict(
            name='p', attrs={'class': ['cintillo']})
    ]

    remove_tags_before = dict(name='div', attrs={'class': ['publi_h']})
    remove_tags_after = dict(
        name='div', attrs={'class': ['tab_util util_estadisticas']})

    remove_tags = [
        dict(name='div', attrs={'class': ['util-1', 'util-2', 'util-3', 'inner estirar', 'inner1', 'inner2', 'inner3', 'cont', 'tab_util util_estadisticas', 'tab_util util_enviar', 'mod_list_inf', 'mod_similares', 'mod_divisas', 'mod_sectores', 'mod_termometro', 'mod post', 'mod_img', 'mod_txt', 'nivel estirar', 'barra estirar', 'info_brujula btnBrujula', 'utilidad_brujula estirar']}), dict(name='li', attrs={'class': ['lnk-fcbook', 'lnk-retweet', 'lnk-meneame', 'desplegable', 'comentarios', 'list-options', 'estirar']}), dict(name='ul', attrs={'class': ['lista-izquierda', 'list-options', 'estirar']}), dict(name='p', attrs={'class': ['autor']})  # noqa
    ]

    extra_css             = """
                               p{text-align: justify; font-size: 100%}
                               body{ text-align: left; font-size:100% }
                               h1{font-family: sans-serif; font-size:150%; font-weight:bold; text-align: justify; }
                               h3{font-family: sans-serif; font-size:100%; font-style: italic; text-align: justify; }
                                 """

    feeds = [

    (u'Ultima Hora', u'http://www.cincodias.com/rss/feed.html?feedId=17029'),
    (u'Empresas', u'http://www.cincodias.com/rss/feed.html?feedId=19'),
    (u'Mercados', u'http://www.cincodias.com/rss/feed.html?feedId=20'),
    (u'Economia', u'http://www.cincodias.com/rss/feed.html?feedId=21'),
    (u'Tecnorama', u'http://www.cincodias.com/rss/feed.html?feedId=17230'),
    (u'Tecnologia', u'http://www.cincodias.com/rss/feed.html?feedId=17106'),
    (u'Finanzas Personales', u'http://www.cincodias.com/rss/feed.html?feedId=22'),
    (u'Fiscalidad', u'http://www.cincodias.com/rss/feed.html?feedId=17107'),
    (u'Vivienda', u'http://www.cincodias.com/rss/feed.html?feedId=17108'),
    (u'Tendencias', u'http://www.cincodias.com/rss/feed.html?feedId=17109'),
    (u'Empleo', u'http://www.cincodias.com/rss/feed.html?feedId=17110'),
    (u'IBEX 35', u'http://www.cincodias.com/rss/feed.html?feedId=17125'),
    (u'Sectores', u'http://www.cincodias.com/rss/feed.html?feedId=17126'),
    (u'Opinion', u'http://www.cincodias.com/rss/feed.html?feedId=17105')
    ]
