mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix EPUB output of Speigel Online
This commit is contained in:
parent
923671d402
commit
5c5cc6d1a2
@ -8,11 +8,11 @@ Fetch Spiegel Online.
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
|
|
||||||
class SpeigelOnline(BasicNewsRecipe):
|
class SpeigelOnline(BasicNewsRecipe):
|
||||||
|
|
||||||
title = 'Spiegel Online'
|
title = 'Spiegel Online'
|
||||||
description = 'Nachrichten des Magazins Der Spiegel'
|
description = 'Nachrichten des Magazins Der Spiegel'
|
||||||
__author__ = 'Kovid Goyal'
|
__author__ = 'Kovid Goyal'
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
@ -22,17 +22,27 @@ class SpeigelOnline(BasicNewsRecipe):
|
|||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
|
|
||||||
preprocess_regexps = \
|
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
|
# Remove Zum Thema footer
|
||||||
(r'<div class="spArticleCredit.*?</body>', lambda match: '</body>'),
|
(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):
|
def print_version(self,url):
|
||||||
tokens = url.split(',')
|
tokens = url.split(',')
|
||||||
tokens[-2:-2] = ['druck|']
|
tokens[-2:-2] = ['druck|']
|
||||||
return ','.join(tokens).replace('|,','-')
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user