mirror of
https://github.com/cupcakearmy/blaze.git
synced 2024-12-22 08:16:26 +00:00
Remove images before parsing
This commit is contained in:
parent
575f529f66
commit
2d87c057e6
4
index.ts
4
index.ts
@ -98,11 +98,13 @@ app.get("/blazed", async (req, res) => {
|
||||
try {
|
||||
const response = await got(pageToBlaze);
|
||||
const { document } = parseHTML(response.body);
|
||||
|
||||
if (!isProbablyReaderable(document)) {
|
||||
return res.sendFile(path.join(__dirname, "/dist/not_blazed.html"));
|
||||
}
|
||||
|
||||
//TODO: find if there are more performant ways to remove images or evaluate if is the case to remove images
|
||||
document.querySelectorAll("img").forEach((img) => img.remove());
|
||||
|
||||
const reader = new Readability(document);
|
||||
const article = reader.parse();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user