diff --git a/scripts/ImgurToPanoramax.ts b/scripts/ImgurToPanoramax.ts index 67c558c22..d186b9cfe 100644 --- a/scripts/ImgurToPanoramax.ts +++ b/scripts/ImgurToPanoramax.ts @@ -111,9 +111,9 @@ export class ImgurToPanoramax extends Script { console.log("Writing fallback to", fallbackpath) writeFileSync(fallbackpath, JSON.stringify(raw), "utf8") }) - console.log("Got license via API:", attr.licenseShortName) + console.log("Got license via API:", attr?.licenseShortName) await ScriptUtils.sleep(500) - if (attr.licenseShortName) { + if (attr?.licenseShortName) { return attr } return undefined @@ -235,12 +235,12 @@ export class ImgurToPanoramax extends Script { const bounds = new BBox([ [ - 1.7217767788980893, - 41.00219164121438 + 4.025057189545606, + 49.588777455920024 ], [ - 2.7238939148245436, - 41.9258679932085 + -16.063346185815476, + 61.187350355346894 ] ]) const maxcount = 10000 @@ -270,7 +270,7 @@ export class ImgurToPanoramax extends Script { } let changedTags: (UploadableTag | undefined)[] = [] - console.log("Handling "+f.properties.id) + console.log(converted+"/"+total, " handling "+f.properties.id) for (const k of ["image", "image:menu", "image:streetsign"]) { changedTags.push(await this.uploadImage(k, f)) for (let i = 0; i < 20; i++) { diff --git a/scripts/generateImageAnalysis.ts b/scripts/generateImageAnalysis.ts index 7dd376ea9..884124313 100644 --- a/scripts/generateImageAnalysis.ts +++ b/scripts/generateImageAnalysis.ts @@ -88,7 +88,7 @@ export default class GenerateImageAnalysis extends Script { if (image === undefined) { return false } - if (!image.match(/https:\/\/i\.imgur\.com\/[a-zA-Z0-9]+\.jpg/)) { + if (!image.match(/https:\/\/i\.imgur\.com\/[a-zA-Z0-9]+(\.jpe?g)|(\.png)/)) { return false } const filename = image.replace(/[\/:.\-%]/g, "_") + ".json" diff --git a/src/Logic/ImageProviders/Imgur.ts b/src/Logic/ImageProviders/Imgur.ts index ccd57b292..1b1b57d70 100644 --- a/src/Logic/ImageProviders/Imgur.ts +++ b/src/Logic/ImageProviders/Imgur.ts @@ -106,8 +106,10 @@ export class Imgur extends ImageProvider { const imgurData = response.data const license= Imgur.parseLicense(imgurData.description ?? "") - license.views = imgurData.views - license.date = new Date(Number(imgurData.datetime) * 1000) + if(license){ + license.views = imgurData.views + license.date = new Date(Number(imgurData.datetime) * 1000) + } return license }