| 1 |
__license__ = 'GPL v3' |
| 2 |
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>' |
| 3 |
''' |
| 4 |
www.elpais.com/suple/eps/ |
| 5 |
''' |
| 6 |
|
| 7 |
from calibre import strftime |
| 8 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 9 |
|
| 10 |
|
| 11 |
class ElPaisSemanal(BasicNewsRecipe): |
| 12 |
title = 'El Pais semanal' |
| 13 |
__author__ = 'Darko Miletic' |
| 14 |
description = 'Revista semanal de diario El Pais' |
| 15 |
publisher = 'EL PAIS S.L.' |
| 16 |
category = 'news, politics, Spain' |
| 17 |
no_stylesheets = True |
| 18 |
encoding = 'cp1252' |
| 19 |
use_embedded_content = False |
| 20 |
language = 'es' |
| 21 |
publication_type = 'magazine' |
| 22 |
masthead_url = 'http://www.elpais.com/im/tit_logo_int.gif' |
| 23 |
index = 'http://www.elpais.com/suple/eps/' |
| 24 |
extra_css = ' p{text-align: justify} body{ text-align: left; font-family: Georgia,"Times New Roman",Times,serif } h2{font-family: Arial,Helvetica,sans-serif} img{margin-bottom: 0.4em} ' # noqa: E501 |
| 25 |
|
| 26 |
conversion_options = {'comment': description, 'tags': category, 'publisher': publisher, 'language': language} |
| 27 |
|
| 28 |
keep_only_tags = [dict(attrs={'class': ['cabecera_noticia', 'contenido_noticia']})] |
| 29 |
remove_attributes = ['width', 'height'] |
| 30 |
remove_tags = [dict(name='link')] |
| 31 |
|
| 32 |
def parse_index(self): |
| 33 |
articles = [] |
| 34 |
soup = self.index_to_soup(self.index) |
| 35 |
for item in soup.findAll('a', attrs={'class': ['g19i003', 'g17r003', 'g17i003']}, href=True): |
| 36 |
description = '' |
| 37 |
title_prefix = '' |
| 38 |
feed_link = item |
| 39 |
url = 'http://www.elpais.com' + item['href'].rpartition('/')[0] |
| 40 |
title = title_prefix + self.tag_to_string(feed_link) |
| 41 |
date = strftime(self.timefmt) |
| 42 |
articles.append({'title': title, 'date': date, 'url': url, 'description': description}) |
| 43 |
return [(soup.head.title.string, articles)] |
| 44 |
|
| 45 |
def print_version(self, url): |
| 46 |
return url + '?print=1' |