From e4b3ee0ce19a7876901346ea0f648db66417a2f1 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sun, 4 Jun 2023 22:14:23 +0200 Subject: [PATCH] Scripts: robustify image downloader --- scripts/generateImageAnalysis.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/generateImageAnalysis.ts b/scripts/generateImageAnalysis.ts index fec854090..d5b5c222d 100644 --- a/scripts/generateImageAnalysis.ts +++ b/scripts/generateImageAnalysis.ts @@ -10,6 +10,7 @@ import { Imgur } from "../Logic/ImageProviders/Imgur" import { LicenseInfo } from "../Logic/ImageProviders/LicenseInfo" import { Utils } from "../Utils" import Constants from "../Models/Constants" +import {concat} from "svelte-preprocess/dist/modules/utils"; export default class GenerateImageAnalysis extends Script { constructor() { @@ -213,8 +214,9 @@ export default class GenerateImageAnalysis extends Script { const speed = handled / runningTime const timeLeft = Math.round(itemsLeft * speed) try { + const urls = url.split(/[;,]/) const downloadedStatus = await Promise.all( - url.split(";").map((url) => this.downloadImage(url.trim(), imagePath)) + urls.map((url) => this.downloadImage(url.trim(), imagePath)) ) for (const b of downloadedStatus) {