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

from calibre.web.feeds.news import BasicNewsRecipe

class UltimaHora_py(BasicNewsRecipe):
    title                 = 'Ultima Hora'
    __author__            = 'Darko Miletic'
    description           = 'Noticias de Paraguay y el resto del mundo'
    publisher             = 'EDITORIAL EL PAIS S.A.'
    category              = 'news, politics, Paraguay'
    oldest_article        = 2
    max_articles_per_feed = 200
    no_stylesheets        = True
    encoding              = 'cp1252'
    use_embedded_content  = False
    language              = 'es_PY'
    remove_empty_feeds    = True
    publication_type      = 'newspaper'
    masthead_url          = 'http://www.ultimahora.com/imgs/uh-com.gif'
    extra_css             = ' body{font-family: Arial,Helvetica,sans-serif } img{margin-bottom: 0.4em} .sub_titulo_mediano,.TituloNota{font-family: Georgia,"Times New Roman",Times,serif} .sub_titulo_mediano{font-weight: bold} '

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

    remove_tags    = [dict(name=['form','iframe','embed','object','link','base','table'])]
    keep_only_tags = [dict(attrs={'id':['nota_titulo','nota_copete','texto']})]


    feeds = [
               (u'Arte y Espectaculos' , u'http://www.ultimahora.com/adjuntos/rss/UHEspectaculos.xml'    )
              ,(u'Ciudad del Este'     , u'http://www.ultimahora.com/adjuntos/rss/UHCDE.xml'             )
              ,(u'Deportes'            , u'http://www.ultimahora.com/adjuntos/rss/UHDeportes.xml'        )
              ,(u'Ultimo momento'      , u'http://www.ultimahora.com/adjuntos/rss/UltimoMomento.xml'     )
              ,(u'Nacionales'          , u'http://www.ultimahora.com/adjuntos/rss/uh-rss-nacionales.xml' )
              ,(u'Politica'            , u'http://www.ultimahora.com/adjuntos/rss/uh-rss-politica.xml'   )
              ,(u'Sucesos'             , u'http://www.ultimahora.com/adjuntos/rss/uh-rss-sucesos.xml'    )
              ,(u'Economia'            , u'http://www.ultimahora.com/adjuntos/rss/uh-rss-economia.xml'   )
              ,(u'Ciencia y Tecnologia', u'http://www.ultimahora.com/adjuntos/rss/uh-rss-ciencia.xml'    )
            ]

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