mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Updated Spiegel Online International. Fixes #806603 (Updated recipe for Spiegel International in english)
This commit is contained in:
parent
1acc8f0c73
commit
357aa7ccc3
@ -1,94 +1,67 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008-2009, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2008-2011, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
spiegel.de
|
spiegel.de
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
|
||||||
class Spiegel_int(BasicNewsRecipe):
|
class Spiegel_int(BasicNewsRecipe):
|
||||||
title = 'Spiegel Online International'
|
title = 'Spiegel Online International'
|
||||||
__author__ = 'Darko Miletic and Sujata Raman'
|
__author__ = 'Darko Miletic and Sujata Raman'
|
||||||
description = "News and POV from Europe's largest newsmagazine"
|
description = "Daily news, analysis and opinion from Europe's leading newsmagazine and Germany's top news Web site"
|
||||||
oldest_article = 7
|
oldest_article = 7
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
language = 'en'
|
language = 'en_DE'
|
||||||
|
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
|
encoding = 'cp1252'
|
||||||
publisher = 'SPIEGEL ONLINE GmbH'
|
publisher = 'SPIEGEL ONLINE GmbH'
|
||||||
category = 'news, politics, Germany'
|
category = 'news, politics, Germany'
|
||||||
lang = 'en'
|
masthead_url = 'http://www.spiegel.de/static/sys/v9/spiegelonline_logo.png'
|
||||||
recursions = 1
|
publication_type = 'magazine'
|
||||||
match_regexps = [r'http://www.spiegel.de/.*-[1-9],00.html']
|
|
||||||
conversion_options = {
|
conversion_options = {
|
||||||
'comments' : description
|
'comments' : description
|
||||||
,'tags' : category
|
,'tags' : category
|
||||||
,'language' : lang
|
,'language' : language
|
||||||
,'publisher': publisher
|
,'publisher': publisher
|
||||||
,'pretty_print': True
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extra_css = '''
|
extra_css = '''
|
||||||
#spArticleColumn{font-family:verdana,arial,helvetica,geneva,sans-serif ; }
|
#spArticleContent{font-family: Verdana,Arial,Helvetica,Geneva,sans-serif}
|
||||||
h1{color:#666666; font-weight:bold;}
|
h1{color:#666666; font-weight:bold;}
|
||||||
h2{color:#990000;}
|
h2{color:#990000;}
|
||||||
h3{color:#990000;}
|
h3{color:#990000;}
|
||||||
h4 {color:#990000;}
|
h4 {color:#990000;}
|
||||||
a{color:#990000;}
|
a{color:#990000;}
|
||||||
.spAuthor{font-style:italic;}
|
.spAuthor{font-style:italic;}
|
||||||
#spIntroTeaser{font-weight:bold;}
|
#spIntroTeaser{font-weight:bold}
|
||||||
.spCredit{color:#666666; font-size:x-small;}
|
.spCredit{color:#666666; font-size:x-small;}
|
||||||
.spShortDate{font-size:x-small;}
|
.spShortDate{font-size:x-small;}
|
||||||
.spArticleImageBox {font-size:x-small;}
|
.spArticleImageBox {font-size:x-small;}
|
||||||
.spPhotoGallery{font-size:x-small; color:#990000 ;}
|
.spPhotoGallery{font-size:x-small; color:#990000 ;}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [dict(attrs={'id':'spArticleContent'})]
|
||||||
dict(name ='div', attrs={'id': ['spArticleImageBox spAssetAlignleft','spArticleColumn']}),
|
remove_tags_after = dict(attrs={'id':'spArticleBody'})
|
||||||
]
|
remove_tags = [dict(name=['meta','base','iframe','embed','object'])]
|
||||||
|
remove_attributes = ['clear']
|
||||||
remove_tags = [
|
feeds = [(u'Spiegel Online', u'http://www.spiegel.de/international/index.rss')]
|
||||||
dict(name='div', attrs={'id':['spSocialBookmark','spArticleFunctions','spMultiPagerHeadlines',]}),
|
|
||||||
dict(name='div', attrs={'class':['spCommercial spM520','spArticleCredit','spPicZoom']}),
|
|
||||||
]
|
|
||||||
|
|
||||||
feeds = [(u'Spiegel Online', u'http://www.spiegel.de/schlagzeilen/rss/0,5291,676,00.xml')]
|
|
||||||
|
|
||||||
def postprocess_html(self, soup,first):
|
|
||||||
|
|
||||||
for tag in soup.findAll(name='div',attrs={'id':"spMultiPagerControl"}):
|
|
||||||
tag.extract()
|
|
||||||
|
|
||||||
p = soup.find(name = 'p', attrs={'id':'spIntroTeaser'})
|
|
||||||
|
|
||||||
if p.string is not None:
|
|
||||||
t = p.string.rpartition(':')[0]
|
|
||||||
|
|
||||||
if 'Part'in t:
|
|
||||||
if soup.h1 is not None:
|
|
||||||
soup.h1.extract()
|
|
||||||
if soup.h2 is not None:
|
|
||||||
soup.h2.extract()
|
|
||||||
functag = soup.find(name= 'div', attrs={'id':"spArticleFunctions"})
|
|
||||||
if functag is not None:
|
|
||||||
functag.extract()
|
|
||||||
auttag = soup.find(name= 'p', attrs={'class':"spAuthor"})
|
|
||||||
if auttag is not None:
|
|
||||||
auttag.extract()
|
|
||||||
|
|
||||||
pictag = soup.find(name= 'div', attrs={'id':"spArticleTopAsset"})
|
|
||||||
if pictag is not None:
|
|
||||||
pictag.extract()
|
|
||||||
|
|
||||||
|
def print_version(self, url):
|
||||||
|
main, sep, rest = url.rpartition(',')
|
||||||
|
rmain, rsep, rrest = main.rpartition(',')
|
||||||
|
return rmain + ',druck-' + rrest + ',' + rest
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
for item in soup.findAll(style=True):
|
||||||
|
del item['style']
|
||||||
|
for item in soup.findAll('a'):
|
||||||
|
if item.string is not None:
|
||||||
|
str = item.string
|
||||||
|
item.replaceWith(str)
|
||||||
|
else:
|
||||||
|
str = self.tag_to_string(item)
|
||||||
|
item.replaceWith(str)
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
# def print_version(self, url):
|
|
||||||
# main, sep, rest = url.rpartition(',')
|
|
||||||
# rmain, rsep, rrest = main.rpartition(',')
|
|
||||||
# return rmain + ',druck-' + rrest + ',' + rest
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user