MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / removeHiddenElements

Function removeHiddenElements

pages/api/parse-html.ts:57–71  ·  view source on GitHub ↗
(
  body: cheerio.Cheerio<cheerio.Element>,
)

Source from the content-addressed store, hash-verified

55}
56
57export function removeHiddenElements(
58 body: cheerio.Cheerio<cheerio.Element>,
59): cheerio.Cheerio<cheerio.Element> {
60 // Absurd, but can't find a better way to remove hidden elements
61 const hidden = [
62 "*[style*=\"display:none\"], *[style*=\"display: none\"], *[style*='display:none'], *[style*='display: none']",
63 "script",
64 "meta",
65 ];
66 hidden.forEach((selector) => {
67 const found = body.find(selector);
68 found.remove();
69 });
70 return body;
71}

Callers 2

parse-html.test.tsFile · 0.90
handlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected