This commit is contained in:
Erick Alvarez 2024-09-25 07:15:31 +05:30 committed by GitHub
commit 194f1c5bbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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}`);