forked from LiveCarta/BookConverter
Add concrete book_id for imgs on Local
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from src.access import Access
|
||||
@@ -35,7 +34,6 @@ def update_images_src_links(body_tag: BeautifulSoup,
|
||||
book_id: str = None) -> dict:
|
||||
"""Function makes dictionary image_src_path -> Amazon web service_path"""
|
||||
img_tags = body_tag.find_all("img")
|
||||
|
||||
for img in img_tags:
|
||||
path_to_img_from_html = img.attrs.get("src")
|
||||
html_folder = os.path.dirname(path_to_html)
|
||||
@@ -55,7 +53,7 @@ def update_images_src_links(body_tag: BeautifulSoup,
|
||||
path2aws_path[path_to_img_from_root] = new_folder
|
||||
else:
|
||||
new_folder = save_image_locally(
|
||||
path_to_img_from_root, img_content, "book_id")
|
||||
path_to_img_from_root, img_content, book_id)
|
||||
|
||||
img.attrs["src"] = str(new_folder)
|
||||
if img.attrs.get("width"):
|
||||
|
||||
Reference in New Issue
Block a user