#!/usr/bin/env  python
##
## Last Edited:  2013-09-29 Carlos Alves <carlosalves90@gmail.com>
##

__license__   = 'GPL v3'
__author__ = '2010, Yuri Alvarez<me at yurialvarez.com>'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'

'''
elobservador.com.uy
'''

from calibre.web.feeds.news import BasicNewsRecipe

class Noticias(BasicNewsRecipe):
    title                 = 'El Observador'
    __author__ = 'yrvn'
    description           = 'Noticias desde Uruguay'
    tags = 'news, sports, entretainment'
    language       = 'es_UY'
    timefmt        = '[%a, %d %b, %Y]'
    use_embedded_content  = False
    recursion             = 5
    encoding = 'utf8'
    remove_javascript = True
    no_stylesheets = True

    oldest_article        = 2
    max_articles_per_feed = 100
    keep_only_tags = [
             dict(name='div', attrs={'class':'story collapsed'})
             ]
    remove_tags = [
             dict(name='div', attrs={'class':['fecha', 'copyright', 'story_right']}),
             dict(name='div', attrs={'class':['photo', 'social']}),
             dict(name='div', attrs={'id':'widget'}),
             dict(name=['object','link'])
                  ]

    remove_attributes = ['width','height', 'style', 'font', 'color']

    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'Portada', u'http://elobservador.com.uy/rss/portada/'),
        ]


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