Skip to content

Commit

Permalink
make the images relative to the content rather than to the assets
Browse files Browse the repository at this point in the history
check 9780596800611 for example
  • Loading branch information
gudata committed Sep 25, 2021
1 parent df0fd8e commit 4a56587
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions safaribooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ def get_book_chapters(self, page=1):
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))

Expand Down Expand Up @@ -814,7 +814,7 @@ def get(self):

# 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
Expand Down Expand Up @@ -863,6 +863,7 @@ def _thread_download_css(self, url):
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)
Expand Down

0 comments on commit 4a56587

Please sign in to comment.