mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
66 lines
2.2 KiB
Python
66 lines
2.2 KiB
Python
#!/usr/bin/env python
|
|
|
|
from __future__ import print_function
|
|
__license__ = 'GPL v3'
|
|
__author__ = '2010, Gustavo Azambuja <hola at gazambuja.com>'
|
|
'''
|
|
observa.com.uy
|
|
'''
|
|
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
|
|
class Noticias(BasicNewsRecipe):
|
|
title = 'Observa Digital'
|
|
__author__ = '2010, Gustavo Azambuja <hola at gazambuja.com>'
|
|
description = 'Noticias desde Uruguay'
|
|
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(id=['contenido'])]
|
|
remove_tags = [
|
|
dict(name='div', attrs={'id': 'contenedorVinculadas'}),
|
|
dict(name='p', attrs={'id': 'nota_firma'}),
|
|
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'Actualidad', u'http://www.observa.com.uy/RSS/actualidad.xml'),
|
|
(u'Deportes', u'http://www.observa.com.uy/RSS/deportes.xml'),
|
|
(u'Vida', u'http://www.observa.com.uy/RSS/vida.xml'),
|
|
(u'Ciencia y Tecnologia', u'http://www.observa.com.uy/RSS/ciencia.xml')
|
|
]
|
|
|
|
def get_cover_url(self):
|
|
cover_url = None
|
|
index = 'http://www.elobservador.com.uy/elobservador/nav_portada.asp?suplemento=dia'
|
|
soup = self.index_to_soup(index)
|
|
link_item = soup.find('img', attrs={'usemap': '#mapeo_imagenes'})
|
|
if link_item:
|
|
cover_url = 'http://www.elobservador.com.uy' + \
|
|
link_item['src'].strip()
|
|
|
|
print(cover_url)
|
|
|
|
return cover_url
|
|
|
|
def preprocess_html(self, soup):
|
|
for item in soup.findAll(style=True):
|
|
del item['style']
|
|
return soup
|