From 19ee4f1eb57748c8b4555cb07e46100ee9c879e2 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Wed, 5 Oct 2022 23:21:14 +0000 Subject: [PATCH] Fix image in PDF and filename --- index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 07427ff..b23b178 100644 --- a/index.js +++ b/index.js @@ -24,6 +24,14 @@ const fetchPage = async (url) => { content.querySelectorAll('iframe').map((c) => c.remove()) content.querySelectorAll('script').map((c) => c.remove()) content.querySelectorAll('div.tiled-gallery').map((c) => c.remove()) + content.querySelectorAll('img').map((c) => { + for (const attr in c.attributes) { + if (attr !== 'src') { + c.removeAttribute(attr) + } + } + }) + const data = content.toString() console.log(title) @@ -62,7 +70,10 @@ const run = async (url, author, lang) => { const page = await fetchPage(link) metadatas.content.push(page) } - const epub = new EPub(metadatas, `output/${title} Volume ${volume}.epub`) + const epub = new EPub( + metadatas, + `output/${title} - Volume ${volume}.epub` + ) await epub.render() } }