| 1 |
__license__ = 'GPL v3' |
| 2 |
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>' |
| 3 |
''' |
| 4 |
www.que-leer.com |
| 5 |
''' |
| 6 |
|
| 7 |
import re |
| 8 |
|
| 9 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 10 |
|
| 11 |
|
| 12 |
class QueLeer(BasicNewsRecipe): |
| 13 |
title = 'Que Leer' |
| 14 |
__author__ = 'Darko Miletic' |
| 15 |
description = 'Libros, Novedades en libros, Criticas, Noticias libro' |
| 16 |
publisher = 'MC Ediciones, S.A.' |
| 17 |
category = 'news, books, criticas, libros' |
| 18 |
oldest_article = 7 |
| 19 |
max_articles_per_feed = 200 |
| 20 |
no_stylesheets = True |
| 21 |
encoding = 'utf-8' |
| 22 |
use_embedded_content = False |
| 23 |
language = 'es' |
| 24 |
remove_empty_feeds = True |
| 25 |
masthead_url = 'http://www.que-leer.com/wp-content/themes/queleer/images/backgrounds/que-leer.jpg' |
| 26 |
extra_css = ' body{font-family: Arial,sans-serif } img{margin-bottom: 0.4em} ' |
| 27 |
|
| 28 |
conversion_options = {'comment': description, 'tags': category, 'publisher': publisher, 'language': language} |
| 29 |
|
| 30 |
preprocess_regexps = [(re.compile(r'<h2 class="izq">.*?</body>', re.DOTALL | re.IGNORECASE), lambda match: '')] |
| 31 |
|
| 32 |
remove_tags = [ |
| 33 |
dict(attrs={'class': ['post-ratings', 'post-ratings-loading', 'sociable', 'toc-anchor']}), |
| 34 |
dict(name=['object', 'embed', 'iframe', 'link']), |
| 35 |
dict(attrs={'id': 'left'}), |
| 36 |
] |
| 37 |
|
| 38 |
remove_tags_after = dict(attrs={'class': 'sociable'}) |
| 39 |
remove_attributes = ['width', 'height'] |
| 40 |
keep_only_tags = [dict(attrs={'class': 'post'})] |
| 41 |
|
| 42 |
feeds = [('Articulos', 'http://www.que-leer.com/feed')] |
| 43 |
|
| 44 |
def preprocess_html(self, soup): |
| 45 |
for item in soup.findAll(style=True): |
| 46 |
del item['style'] |
| 47 |
url = 'http://www.que-leer.com/comprar-libros-tienda-que-leer/libros-recomendados' |
| 48 |
fitem = soup.find('a', href=url) |
| 49 |
if fitem: |
| 50 |
par = fitem.parent |
| 51 |
par.extract() |
| 52 |
return self.adeify_images(soup) |