mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
67 lines
3.0 KiB
Python
67 lines
3.0 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
__license__ = 'GPL v3'
|
|
__copyright__ = '30 October 2010, Jordi Balcells based on an earlier recipe by Darko Miletic <darko.miletic at gmail.com>'
|
|
'''
|
|
elperiodico.cat
|
|
'''
|
|
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
from calibre.ebooks.BeautifulSoup import Tag
|
|
|
|
class ElPeriodico_cat(BasicNewsRecipe):
|
|
title = 'El Periodico de Catalunya'
|
|
__author__ = 'Jordi Balcells/Darko Miletic'
|
|
description = 'Noticies des de Catalunya'
|
|
publisher = 'elperiodico.cat'
|
|
category = 'news, politics, Spain, Catalunya'
|
|
oldest_article = 2
|
|
max_articles_per_feed = 100
|
|
no_stylesheets = True
|
|
use_embedded_content = False
|
|
delay = 1
|
|
encoding = 'cp1252'
|
|
language = 'ca'
|
|
|
|
|
|
html2lrf_options = [
|
|
'--comment' , description
|
|
, '--category' , category
|
|
, '--publisher', publisher
|
|
]
|
|
|
|
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
|
|
|
|
feeds = [(u'Portada', u'http://www.elperiodico.cat/ca/rss/rss_portada.xml'),
|
|
(u'Internacional', u'http://www.elperiodico.cat/ca/rss/internacional/rss.xml'),
|
|
(u'Societat', u'http://www.elperiodico.cat/ca/rss/societat/rss.xml'),
|
|
(u'Ci\xe8ncia i tecnologia', u'http://www.elperiodico.cat/ca/rss/ciencia-i-tecnologia/rss.xml'),
|
|
(u'Esports', u'http://www.elperiodico.cat/ca/rss/esports/rss.xml'),
|
|
(u'Gent', u'http://www.elperiodico.cat/ca/rss/gent/rss.xml'),
|
|
(u'Opini\xf3', u'http://www.elperiodico.cat/ca/rss/opinio/rss.xml'),
|
|
(u'Pol\xedtica', u'http://www.elperiodico.cat/ca/rss/politica/rss.xml'),
|
|
(u'Barcelona', u'http://www.elperiodico.cat/ca/rss/barcelona/rss.xml'),
|
|
(u'Economia', u'http://www.elperiodico.cat/ca/rss/economia/rss.xml'),
|
|
(u'Cultura i espectacles', u'http://www.elperiodico.cat/ca/rss/cultura-i-espectacles/rss.xml'),
|
|
(u'Tele', u'http://www.elperiodico.cat/ca/rss/tele/rss.xml')]
|
|
|
|
|
|
keep_only_tags = [dict(name='div', attrs={'class':'titularnoticia'}),
|
|
dict(name='div', attrs={'class':'noticia_completa'})]
|
|
|
|
remove_tags = [dict(name='div', attrs={'class':['opcionb','opcionb last','columna_noticia']}),
|
|
dict(name='span', attrs={'class':'opcionesnoticia'})
|
|
]
|
|
|
|
def print_version(self, url):
|
|
return url.replace('/default.asp?','/print.asp?')
|
|
|
|
def preprocess_html(self, soup):
|
|
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
|
|
soup.head.insert(0,mcharset)
|
|
for item in soup.findAll(style=True):
|
|
del item['style']
|
|
return soup
|
|
|