Fix EPUB output of Speigel Online

This commit is contained in:
Kovid Goyal 2009-03-23 13:44:58 -07:00
parent 923671d402
commit 5c5cc6d1a2

View File

@ -8,11 +8,11 @@ Fetch Spiegel Online.
import re
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import BeautifulSoup
class SpeigelOnline(BasicNewsRecipe):
title = 'Spiegel Online'
title = 'Spiegel Online'
description = 'Nachrichten des Magazins Der Spiegel'
__author__ = 'Kovid Goyal'
use_embedded_content = False
@ -22,17 +22,27 @@ class SpeigelOnline(BasicNewsRecipe):
no_stylesheets = True
preprocess_regexps = \
[ (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in
[ (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in
[
# Remove Zum Thema footer
(r'<div class="spArticleCredit.*?</body>', lambda match: '</body>'),
]
]
feeds= [ ('Spiegel Online', 'http://www.spiegel.de/schlagzeilen/rss/0,5291,,00.xml') ]
feeds= [ ('Spiegel Online', 'http://www.spiegel.de/schlagzeilen/rss/0,5291,,00.xml') ]
def print_version(self,url):
tokens = url.split(',')
tokens[-2:-2] = ['druck|']
return ','.join(tokens).replace('|,','-')
def postprocess_html(self, soup, first_fetch):
if soup.contents[0].name == 'head':
x = BeautifulSoup('<html></html>')
for y in reversed(soup.contents):
x.contents[0].insert(0, y)
soup = x
print 1111111
return soup