mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1105 (Wall St. Journal articles incomplete)
This commit is contained in:
parent
375d2470f5
commit
ce02f5c433
@ -614,6 +614,8 @@ class BasicNewsRecipe(object, LoggingInterface):
|
|||||||
except NotImplementedError:
|
except NotImplementedError:
|
||||||
feeds = self.parse_feeds()
|
feeds = self.parse_feeds()
|
||||||
|
|
||||||
|
#feeds = FeedCollection(feeds)
|
||||||
|
|
||||||
self.report_progress(0, _('Trying to download cover...'))
|
self.report_progress(0, _('Trying to download cover...'))
|
||||||
self.download_cover()
|
self.download_cover()
|
||||||
if self.test:
|
if self.test:
|
||||||
@ -675,6 +677,8 @@ class BasicNewsRecipe(object, LoggingInterface):
|
|||||||
except NoResultsPending:
|
except NoResultsPending:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
#feeds.restore_duplicates()
|
||||||
|
|
||||||
for f, feed in enumerate(feeds):
|
for f, feed in enumerate(feeds):
|
||||||
html = self.feed2index(feed)
|
html = self.feed2index(feed)
|
||||||
feed_dir = os.path.join(self.output_dir, 'feed_%d'%f)
|
feed_dir = os.path.join(self.output_dir, 'feed_%d'%f)
|
||||||
@ -745,20 +749,21 @@ class BasicNewsRecipe(object, LoggingInterface):
|
|||||||
entries.append(relp.replace(os.sep, '/'))
|
entries.append(relp.replace(os.sep, '/'))
|
||||||
last = sp
|
last = sp
|
||||||
|
|
||||||
with open(last, 'rb') as fi:
|
if os.path.exists(last):
|
||||||
src = fi.read().decode('utf-8')
|
with open(last, 'rb') as fi:
|
||||||
soup = BeautifulSoup(src)
|
src = fi.read().decode('utf-8')
|
||||||
body = soup.find('body')
|
soup = BeautifulSoup(src)
|
||||||
if body is not None:
|
body = soup.find('body')
|
||||||
prefix = '/'.join('..'for i in range(2*len(re.findall(r'link\d+', last))))
|
if body is not None:
|
||||||
templ = self.navbar.generate(True, num, j, len(f),
|
prefix = '/'.join('..'for i in range(2*len(re.findall(r'link\d+', last))))
|
||||||
not self.has_single_feed,
|
templ = self.navbar.generate(True, num, j, len(f),
|
||||||
a.orig_url, __appname__, prefix=prefix,
|
not self.has_single_feed,
|
||||||
center=self.center_navbar)
|
a.orig_url, __appname__, prefix=prefix,
|
||||||
elem = BeautifulSoup(templ.render(doctype='xhtml').decode('utf-8')).find('div')
|
center=self.center_navbar)
|
||||||
body.insert(len(body.contents), elem)
|
elem = BeautifulSoup(templ.render(doctype='xhtml').decode('utf-8')).find('div')
|
||||||
with open(last, 'wb') as fi:
|
body.insert(len(body.contents), elem)
|
||||||
fi.write(unicode(soup).encode('utf-8'))
|
with open(last, 'wb') as fi:
|
||||||
|
fi.write(unicode(soup).encode('utf-8'))
|
||||||
|
|
||||||
if len(feeds) > 1:
|
if len(feeds) > 1:
|
||||||
for i, f in enumerate(feeds):
|
for i, f in enumerate(feeds):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user