Fix 874643

This commit is contained in:
Kovid Goyal 2011-10-15 06:15:28 +05:30
parent dcf45ce797
commit 51b819f638
2 changed files with 30 additions and 26 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

View File

@ -1,51 +1,55 @@
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__author__ = 'Lorenzo Vigentini, based on Darko Miletic, Gabriele Marini' __author__ = 'Lorenzo Vigentini, based on Darko Miletic, Gabriele Marini'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>, Lorenzo Vigentini <l.vigentini at gmail.com>' __copyright__ = '2009-2011, Darko Miletic <darko.miletic at gmail.com>, Lorenzo Vigentini <l.vigentini at gmail.com>'
description = 'Italian daily newspaper - v1.01 (04, January 2010); 16.05.2010 new version' description = 'Italian daily newspaper - v1.01 (04, January 2010); 16.05.2010 new version'
''' '''
http://www.repubblica.it/ http://www.repubblica.it/
''' '''
import re
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class LaRepubblica(BasicNewsRecipe): class LaRepubblica(BasicNewsRecipe):
__author__ = 'Lorenzo Vigentini, Gabriele Marini' title = 'La Repubblica'
description = 'Italian daily newspaper' __author__ = 'Lorenzo Vigentini, Gabriele Marini, Darko Miletic'
description = 'il quotidiano online con tutte le notizie in tempo reale. News e ultime notizie. Tutti i settori: politica, cronaca, economia, sport, esteri, scienza, tecnologia, internet, spettacoli, musica, cultura, arte, mostre, libri, dvd, vhs, concerti, cinema, attori, attrici, recensioni, chat, cucina, mappe. Le citta di Repubblica: Roma, Milano, Bologna, Firenze, Palermo, Napoli, Bari, Torino.'
cover_url = 'http://www.repubblica.it/images/homepage/la_repubblica_logo.gif' masthead_url = 'http://www.repubblica.it/static/images/homepage/2010/la-repubblica-logo-home-payoff.png'
title = u'La Repubblica' publisher = 'Gruppo editoriale L\'Espresso'
publisher = 'Gruppo editoriale L\'Espresso' category = 'News, politics, culture, economy, general interest'
category = 'News, politics, culture, economy, general interest' language = 'it'
timefmt = '[%a, %d %b, %Y]'
language = 'it' oldest_article = 5
timefmt = '[%a, %d %b, %Y]' encoding = 'utf8'
use_embedded_content = False
oldest_article = 5 #recursion = 10
max_articles_per_feed = 100 no_stylesheets = True
use_embedded_content = False extra_css = """
recursion = 10 img{display: block}
"""
remove_javascript = True
no_stylesheets = True
preprocess_regexps = [
(re.compile(r'.*?<head>', re.DOTALL|re.IGNORECASE), lambda match: '<head>'),
(re.compile(r'<head>.*?<title>', re.DOTALL|re.IGNORECASE), lambda match: '<head><title>'),
(re.compile(r'</title>.*?</head>', re.DOTALL|re.IGNORECASE), lambda match: '</title></head>')
]
def get_article_url(self, article): def get_article_url(self, article):
link = article.get('id', article.get('guid', None)) link = article.get('id', article.get('guid', None))
if link is None: if link is None:
return article return article
return link return link
keep_only_tags = [dict(name='div', attrs={'class':'articolo'}), keep_only_tags = [
dict(name='div', attrs={'class':'body-text'}), dict(attrs={'class':'articolo'}),
# dict(name='div', attrs={'class':'page-content'}), dict(attrs={'class':'body-text'}),
dict(name='p', attrs={'class':'disclaimer clearfix'}), dict(name='p', attrs={'class':'disclaimer clearfix'}),
dict(name='div', attrs={'id':'contA'}) dict(attrs={'id':'contA'})
] ]
remove_tags = [ remove_tags = [
dict(name=['object','link']), dict(name=['object','link','meta']),
dict(name='span',attrs={'class':'linkindice'}), dict(name='span',attrs={'class':'linkindice'}),
dict(name='div', attrs={'class':'bottom-mobile'}), dict(name='div', attrs={'class':'bottom-mobile'}),
dict(name='div', attrs={'id':['rssdiv','blocco']}), dict(name='div', attrs={'id':['rssdiv','blocco']}),