From 8fb24e876d7a1f66a38fc6b9c31662672406bfe0 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Wed, 26 Oct 2022 12:42:53 +0000 Subject: [PATCH] Update lock --- index.js | 11 +++++------ yarn.lock | 12 ++++++------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index b23b178..2db5ad4 100644 --- a/index.js +++ b/index.js @@ -18,12 +18,11 @@ const fetchPage = async (url) => { const title = html.querySelector('h1.entry-title').text const content = html.querySelector('div.entry-content') - content.querySelectorAll('a').map((c) => c.remove()) - content.querySelectorAll('h3').map((c) => c.remove()) - content.querySelectorAll('hr').map((c) => c.remove()) - content.querySelectorAll('iframe').map((c) => c.remove()) - content.querySelectorAll('script').map((c) => c.remove()) - content.querySelectorAll('div.tiled-gallery').map((c) => c.remove()) + + for (const el of ['a', 'h3', 'hr', 'iframe', 'script', 'div.tiled-gallery']) { + content.querySelectorAll(el).map((c) => c.remove()) + } + content.querySelectorAll('img').map((c) => { for (const attr in c.attributes) { if (attr !== 'src') { diff --git a/yarn.lock b/yarn.lock index b9e9ac6..696e22b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -98,9 +98,9 @@ acorn-jsx@^5.3.2: integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn@^8.8.0: - version "8.8.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.0.tgz#88c0187620435c7f6015803f5539dae05a9dbea8" - integrity sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w== + version "8.8.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" + integrity sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA== ajv@^6.10.0, ajv@^6.12.4: version "6.12.6" @@ -734,9 +734,9 @@ hast-util-whitespace@^2.0.0: integrity sha512-Pkw+xBHuV6xFeJprJe2BBEoDV+AvQySaz3pPDRUs5PNZEMQjpXJJueqrpcHIXxnWTcAGi/UOCgVShlkY6kLoqg== hastscript@^7.0.0: - version "7.0.2" - resolved "https://registry.yarnpkg.com/hastscript/-/hastscript-7.0.2.tgz#d811fc040817d91923448a28156463b2e40d590a" - integrity sha512-uA8ooUY4ipaBvKcMuPehTAB/YfFLSSzCwFSwT6ltJbocFUKH/GDHLN+tflq7lSRf9H86uOuxOFkh1KgIy3Gg2g== + version "7.1.0" + resolved "https://registry.yarnpkg.com/hastscript/-/hastscript-7.1.0.tgz#e402ed48f46161cf2f093badbff30583a5c3c315" + integrity sha512-uBjaTTLN0MkCZxY/R2fWUOcu7FRtUVzKRO5P/RAfgsu3yFiMB1JWCO4AjeVkgHxAira1f2UecHK5WfS9QurlWA== dependencies: "@types/hast" "^2.0.0" comma-separated-tokens "^2.0.0"