mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix #1867 (Time magazine download failure)
This commit is contained in:
parent
da33e04397
commit
a8d514092f
@ -493,6 +493,16 @@ class Parser(PreProcessor, LoggingInterface):
|
|||||||
self.root.insert(0, head)
|
self.root.insert(0, head)
|
||||||
|
|
||||||
self.head = head
|
self.head = head
|
||||||
|
try:
|
||||||
|
self.body = self.root.body
|
||||||
|
except:
|
||||||
|
import traceback
|
||||||
|
err = traceback.format_exc()
|
||||||
|
self.root = fromstring(u'<html><head/><body><p>This page was too '
|
||||||
|
'severely malformed for calibre to handle. '
|
||||||
|
'It has been replaced by this error message.'
|
||||||
|
'</p><pre>%s</pre></body></html>'%err)
|
||||||
|
self.head = self.root.xpath('./head')[0]
|
||||||
self.body = self.root.body
|
self.body = self.root.body
|
||||||
for a in self.root.xpath('//a[@name]'):
|
for a in self.root.xpath('//a[@name]'):
|
||||||
a.set('id', a.get('name'))
|
a.set('id', a.get('name'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user