diff options
author | Aleteoryx <alyx@aleteoryx.me> | 2024-11-14 17:53:05 -0500 |
---|---|---|
committer | Aleteoryx <alyx@aleteoryx.me> | 2024-11-14 17:56:03 -0500 |
commit | 10f26c2ae98dd1414e3b84fea400478f28d742a6 (patch) | |
tree | ff9df87e9de55527c82ccb5a1ae141ca7810ea08 | |
parent | ed7eeb11c74bd8fedf40d0618e34c4a6c1f5b10a (diff) | |
download | rss_dot_php-10f26c2ae98dd1414e3b84fea400478f28d742a6.tar.gz rss_dot_php-10f26c2ae98dd1414e3b84fea400478f28d742a6.tar.bz2 rss_dot_php-10f26c2ae98dd1414e3b84fea400478f28d742a6.zip |
better stripping
-rw-r--r-- | rss.php | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -175,6 +175,19 @@ function strip_html(string $html): string { $el->remove(); foreach($doc->getElementsByTagName("link")->getIterator() as $el) $el->remove(); + foreach($doc->getElementsByTagName("meta")->getIterator() as $el) + $el->remove(); + foreach($doc->getElementsByTagName("base")->getIterator() as $el) + $el->remove(); + foreach($doc->getElementsByTagName("title")->getIterator() as $el) + $el->remove(); + foreach($doc->getElementsByTagName("template")->getIterator() as $el) + $el->remove(); + foreach($doc->getElementsByTagName("slot")->getIterator() as $el) + $el->remove(); + + foreach($doc->getElementsByTagName("img")->getIterator() as $el) + $el->setAttribute("loading", "lazy"); foreach($doc->getElementsByTagName("*")->getIterator() as $el) { if (str_starts_with($el->getAttribute("href"), "javascript:")) |