( body: cheerio.Cheerio<cheerio.Element>, )
| 55 | } |
| 56 | |
| 57 | export 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 | } |
no outgoing calls
no test coverage detected