| 1 |
__license__ = 'GPL v3' |
| 2 |
__copyright__ = '2013, Darko Miletic <darko.miletic at gmail.com>' |
| 3 |
''' |
| 4 |
www.libertaddigital.com |
| 5 |
''' |
| 6 |
|
| 7 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 8 |
|
| 9 |
|
| 10 |
class LibertadDigital(BasicNewsRecipe): |
| 11 |
title = 'Libertad Digital' |
| 12 |
__author__ = 'Darko Miletic' |
| 13 |
description = 'En Libertad Digital encontraras noticias y opinion sobre: España, el Mundo, Internet, sociedad, economia y deportes' |
| 14 |
publisher = 'Libertad Digital S.A.' |
| 15 |
category = 'noticias, ultima hora, españa, internet, mundo, economia, sociedad, Libertad Digital' |
| 16 |
oldest_article = 2 |
| 17 |
max_articles_per_feed = 200 |
| 18 |
no_stylesheets = True |
| 19 |
encoding = 'cp1252' |
| 20 |
use_embedded_content = False |
| 21 |
language = 'es' |
| 22 |
remove_empty_feeds = True |
| 23 |
publication_type = 'website' |
| 24 |
masthead_url = 'http://s.libertaddigital.com/images/logo.gif' |
| 25 |
extra_css = ''' |
| 26 |
body{font-family: Verdana,sans-serif } |
| 27 |
img{margin-bottom: 0.4em; display:block} |
| 28 |
''' |
| 29 |
|
| 30 |
conversion_options = {'comment': description, 'tags': category, 'publisher': publisher, 'language': language} |
| 31 |
|
| 32 |
remove_tags = [dict(name=['meta', 'link', 'iframe', 'embed', 'object']), dict(name='p', attrs={'class': 'copyright'})] |
| 33 |
remove_attributes = ['lang'] |
| 34 |
|
| 35 |
feeds = [ |
| 36 |
('Portada', 'http://feeds2.feedburner.com/libertaddigital/deportes'), |
| 37 |
('Opinion', 'http://feeds2.feedburner.com/libertaddigital/opinion'), |
| 38 |
('España', 'http://feeds2.feedburner.com/libertaddigital/nacional'), |
| 39 |
('Internacional', 'http://feeds2.feedburner.com/libertaddigital/internacional'), |
| 40 |
('Libre Mercado', 'http://feeds2.feedburner.com/libertaddigital/economia'), |
| 41 |
('Chic', 'http://feeds2.feedburner.com/libertaddigital/el-candelabro'), |
| 42 |
('Internet', 'http://feeds2.feedburner.com/libertaddigital/internet'), |
| 43 |
('Deportes', 'http://feeds2.feedburner.com/libertaddigital/deportes'), |
| 44 |
] |
| 45 |
|
| 46 |
def get_article_url(self, article): |
| 47 |
return article.get('guid', None) |
| 48 |
|
| 49 |
def print_version(self, url): |
| 50 |
art, sep, rest = url.rpartition('/') |
| 51 |
aart, asep, artid = art.rpartition('-') |
| 52 |
return 'http://www.libertaddigital.com/c.php?op=imprimir&id=' + artid |
| 53 |
|
| 54 |
def preprocess_html(self, soup): |
| 55 |
for item in soup.findAll(style=True): |
| 56 |
del item['style'] |
| 57 |
return soup |