From 4a5658791c54454294cedde46c67ecf85530df1d Mon Sep 17 00:00:00 2001 From: gudata Date: Sat, 25 Sep 2021 14:17:31 +0300 Subject: [PATCH] make the images relative to the content rather than to the assets check 9780596800611 for example --- safaribooks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/safaribooks.py b/safaribooks.py index a7f6fdb..2e1e0da 100755 --- a/safaribooks.py +++ b/safaribooks.py @@ -553,7 +553,7 @@ class SafariBooks: self.display.exit("API: unable to retrieve book chapters.") response = response.json() - + if not isinstance(response, dict) or len(response.keys()) == 1: self.display.exit(self.display.api_error(response)) @@ -814,7 +814,7 @@ class SafariBooks: # Images if "images" in next_chapter and len(next_chapter["images"]): - self.images.extend(urljoin(next_chapter['asset_base_url'], img_url) + self.images.extend(urljoin(next_chapter['content'], img_url) for img_url in next_chapter['images']) # Stylesheets @@ -863,6 +863,7 @@ class SafariBooks: self.css_done_queue.put(1) self.display.state(len(self.css), self.css_done_queue.qsize()) + def _thread_download_images(self, url): image_name = url.split("/")[-1] image_path = os.path.join(self.images_path, image_name)