From 77e0e78dd4628061f4b24ebded06bbd2adc1cfa0 Mon Sep 17 00:00:00 2001 From: Erick Alvarez Date: Tue, 24 Sep 2024 18:03:22 -0700 Subject: [PATCH] why not downloading all resolutions? --- mkbsd.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mkbsd.js b/mkbsd.js index d02593a..fb74cee 100644 --- a/mkbsd.js +++ b/mkbsd.js @@ -27,12 +27,12 @@ async function main() { let fileIndex = 1; for (const key in data) { const subproperty = data[key]; - if (subproperty && subproperty.dhd) { - const imageUrl = subproperty.dhd; + for(const subpropertyKey in subproperty) { + const imageUrl = subproperty[subpropertyKey]; console.info(`🔍 Found image URL!`); await delay(100); const ext = path.extname(new URL(imageUrl).pathname) || '.jpg'; - const filename = `${fileIndex}${ext}`; + const filename = `${key}-${subpropertyKey}${ext}`; const filePath = path.join(downloadDir, filename); await downloadImage(imageUrl, filePath); console.info(`🖼️ Saved image to ${filePath}`);