__license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
'''
eluniverso.com
'''

from calibre.web.feeds.news import BasicNewsRecipe


class ElUniverso_Ecuador(BasicNewsRecipe):
    title = 'El Universo - Ecuador'
    __author__ = 'Darko Miletic'
    description = 'Noticias del Ecuador y el resto del mundo'
    publisher = 'El Universo'
    category = 'news, politics, Ecuador'
    oldest_article = 2
    max_articles_per_feed = 200
    no_stylesheets = True
    encoding = 'utf8'
    use_embedded_content = False
    language = 'es_EC'
    remove_empty_feeds = True
    publication_type = 'newspaper'
    masthead_url = 'http://servicios2.eluniverso.com/versiones/v1/img/Hd/lg_ElUniverso.gif'
    extra_css             = """
                                body{font-family: Verdana,Arial,Helvetica,sans-serif; color: #333333 }
                                h2{font-family: Georgia,"Times New Roman",Times,serif; color: #1B2D60}
                            """

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

    remove_tags = [
        dict(attrs={'class': ['flechs', 'multiBox', 'colRecursos']}), dict(
            name=['meta', 'link', 'embed', 'object', 'iframe', 'base'])
    ]
    keep_only_tags = [dict(attrs={'class': 'Nota'})]
    remove_tags_after = dict(attrs={'id': 'TextoPrint'})
    remove_tags_before = dict(attrs={'id': 'FechaPrint'})

    feeds = [

    (u'Portada', u'http://www.eluniverso.com/rss/portada.xml'),
    (u'Politica', u'http://www.eluniverso.com/rss/politica.xml'),
    (u'Economia', u'http://www.eluniverso.com/rss/economia.xml'),
    (u'Sucesos', u'http://www.eluniverso.com/rss/sucesos.xml'),
    (u'Migracion', u'http://www.eluniverso.com/rss/migrantes_tema.xml'),
    (u'El Pais', u'http://www.eluniverso.com/rss/elpais.xml'),
    (u'Internacionales', u'http://www.eluniverso.com/rss/internacionales.xml'),
    (u'Deportes', u'http://www.eluniverso.com/rss/deportes.xml'),
    (u'Gran Guayaquill', u'http://www.eluniverso.com/rss/gran_guayaquil.xml'),
    (u'Entretenimiento', u'http://www.eluniverso.com/rss/arteyespectaculos.xml'),
    (u'Vida', u'http://www.eluniverso.com/rss/tuvida.xml'),
    (u'Opinion', u'http://www.eluniverso.com/rss/opinion.xml')
    ]

    def preprocess_html(self, soup):
        for item in soup.findAll(style=True):
            del item['style']
        return soup
