Skip to content

Commit

Permalink
Merge pull request #2193 from jere344/patch-1
Browse files Browse the repository at this point in the history
Memory optimization
  • Loading branch information
dipu-bd authored Nov 10, 2023
2 parents c666449 + d612e8f commit 3f4daa7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lncrawl/core/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _save_chapter(app, chapter: Chapter):
title = ">".join(title.split(">"))
title = f"<h1>{title}</h1>"
if not chapter.body.startswith(title):
chapter.body = title + chapter.body
chapter.body = "".join([title, chapter.body])

file_name = _chapter_file(
chapter,
Expand Down Expand Up @@ -116,6 +116,7 @@ def _fetch_content_image(app, url, image_file):
else:
img = img.convert("RGB")
img.save(image_file, "JPEG", optimized=True)
img.close()
logger.debug("Saved image: %s", image_file)
finally:
app.progress += 1
Expand Down

0 comments on commit 3f4daa7

Please sign in to comment.