diff --git a/src/api/src/create_book.py b/src/api/src/create_book.py index 468468e..0879248 100644 --- a/src/api/src/create_book.py +++ b/src/api/src/create_book.py @@ -177,7 +177,6 @@ async def add_chapters( for cidx, part in enumerate(data["parts"]): content = await fetch_part_content(part["id"], cookies=cookies) title = part["title"] - clean_title = slugify(title) # Thanks https://eu17.proxysite.com/process.php?d=5VyWYcoQl%2BVF0BYOuOavtvjOloFUZz2BJ%2Fepiusk6Nz7PV%2B9i8rs7cFviGftrBNll%2B0a3qO7UiDkTt4qwCa0fDES&b=1 chapter = epub.EpubHtml( @@ -188,6 +187,7 @@ async def add_chapters( if download_images: soup = BeautifulSoup(content, "lxml") + async with ( CachedSession(headers=headers, cache=cache) if not cookies @@ -196,6 +196,8 @@ async def add_chapters( for idx, image in enumerate(soup.find_all("img")): if not image["src"]: continue + # Find all image tags and filter for those with sources + async with session.get(image["src"]) as response: img = epub.EpubImage( media_type="image/jpeg", @@ -203,8 +205,10 @@ async def add_chapters( file_name=f"static/{cidx}/{idx}.jpeg", ) book.add_item(img) + # Fetch image and pack + content = content.replace( - str(image), f'' + str(image["src"]), f"static/{cidx}/{idx}.jpeg" ) chapter.set_content(f"

{title}

" + content) diff --git a/src/frontend/src/routes/+page.svelte b/src/frontend/src/routes/+page.svelte index fc95c30..8b0ab1e 100644 --- a/src/frontend/src/routes/+page.svelte +++ b/src/frontend/src/routes/+page.svelte @@ -68,6 +68,8 @@