fix(removeUnwantedElements): post-includeTags excludeTags

Fixes #700
This commit is contained in:
Móricz Gergő 2025-01-17 12:41:00 +01:00
parent de08b37480
commit faf58dfca7

View File

@ -54,7 +54,7 @@ export const htmlTransform = (
url: string, url: string,
scrapeOptions: ScrapeOptions, scrapeOptions: ScrapeOptions,
) => { ) => {
const soup = load(html); let soup = load(html);
// remove unwanted elements // remove unwanted elements
if ( if (
@ -68,7 +68,8 @@ export const htmlTransform = (
newRoot.append(soup(element).clone()); newRoot.append(soup(element).clone());
}); });
}); });
return newRoot.html() ?? "";
soup = load(newRoot.html() ?? "");
} }
soup("script, style, noscript, meta, head").remove(); soup("script, style, noscript, meta, head").remove();