#!/usr/bin/env  python2
##
# Title:        lr21.com.uy News, Sports, and Blog Calibre Recipe
# Contact:      Carlos Alves - <carlos@carlosalves.info>
##
# License:      GNU General Public License v3 - http://www.gnu.org/copyleft/gpl.html
# Copyright:    Carlos Alves - <carlos@carlosalves.info>
##
# Written:      January 2016
# Last Edited:  2016-01-11
##
__license__ = 'GPL v3'
__author__ = '2016, Carlos Alves <carlos@carlosalves.info>'

'''
lr21.com.uy
'''

from calibre.web.feeds.news import BasicNewsRecipe


class General(BasicNewsRecipe):
    title = 'LaRed21'
    __author__ = 'Carlos Alves'
    description = 'LaRed21 Diario Digital'
    tags = 'soccer, futbol, news'
    language = 'es_UY'
    timefmt = '[%a, %d %b, %Y]'
    use_embedded_content = False
    recursion = 5
    encoding = None
    remove_javascript = True
    no_stylesheets = True

    oldest_article = 10
    max_articles_per_feed = 100
    keep_only_tags = [
        dict(name='h1', attrs={'id': 'article-title'}),
        dict(name='h2', attrs={'class': 'copete'}),
        dict(name='div', attrs={'class': 'article-content clear bottom-1'})
    ]

    remove_tags = [
        dict(name='div', attrs={
             'class': ['br', 'hr', 'titlebar', 'navigation']}),
        dict(name='dl', attrs={'class': 'gallery-item'}),
        dict(name=['object', 'link'])
    ]

    extra_css = '''
                h1{font-family:Geneva, Arial, Helvetica, sans-serif;color:#154B7A;}
                h3{font-size: 14px;color:#999999; font-family:Geneva, Arial, Helvetica, sans-serif;font-weight: bold;}
                h2{color:#666666; font-family:Geneva, Arial, Helvetica, sans-serif;font-size:small;}
                p {font-family:Arial,Helvetica,sans-serif;}
                '''
    feeds = [
        (u'LaRed21 Diario Digital', u'http://www.lr21.com.uy/feed')
    ]

    def get_cover_url(self):
        pass

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