From 8a3cdf0257dee45cf21fd4fe19a1a509a8ca0f9c Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Tue, 15 Sep 2026 15:24:47 +0200 Subject: [PATCH] fix: Remove google-img-scrap Signed-off-by: Marcel Klehr --- package-lock.json | 175 +-------------------------------------- package.json | 1 - tests/faces-tests.js | 20 +---- tests/landmarks-tests.js | 14 ---- 4 files changed, 7 insertions(+), 203 deletions(-) diff --git a/package-lock.json b/package-lock.json index eaf7f9050..1ea773852 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "recognize", - "version": "13.1.0-dev.0", + "version": "13.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "recognize", - "version": "13.1.0-dev.0", + "version": "13.1.0", "license": "MIT", "dependencies": { "@exifer/gps": "^1.0.0-beta.2", @@ -42,12 +42,11 @@ "async-parallel": "^1.2.3", "fast-glob": "^3.2.11", "flickr-sdk": "^6.0.0", - "google-img-scrap": "^1.0.6", "vue": "3.x" }, "engines": { - "node": "20.x", - "npm": "10.x" + "node": "22.x", + "npm": "11.x" } }, "node_modules/@babel/code-frame": { @@ -9988,16 +9987,6 @@ "license": "MIT", "peer": true }, - "node_modules/google-img-scrap": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/google-img-scrap/-/google-img-scrap-1.1.8.tgz", - "integrity": "sha512-SIkk879fhphbqOw1zWfC7pJJkvmg8CB+c/C+jhneyE9YAJRlSIl+d3l9ByR8p9MDWPVCFjY7HATRvxRXZ1Qe6Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "impit": "^0.9.2" - } - }, "node_modules/google-protobuf": { "version": "3.21.4", "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.4.tgz", @@ -10806,162 +10795,6 @@ "license": "MIT", "peer": true }, - "node_modules/impit": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/impit/-/impit-0.9.2.tgz", - "integrity": "sha512-flHQYxC16o7H+OKrO0zXv8Ob8Hs/E1Z1CfjGUHkN+6qqQksi1/2KMnZZEeSWfB9fM4b8SQVL6aQha/K6qVKqng==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">= 20" - }, - "optionalDependencies": { - "impit-darwin-arm64": "0.9.2", - "impit-darwin-x64": "0.9.2", - "impit-linux-arm64-gnu": "0.9.2", - "impit-linux-arm64-musl": "0.9.2", - "impit-linux-x64-gnu": "0.9.2", - "impit-linux-x64-musl": "0.9.2", - "impit-win32-arm64-msvc": "0.9.2", - "impit-win32-x64-msvc": "0.9.2" - } - }, - "node_modules/impit-darwin-arm64": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/impit-darwin-arm64/-/impit-darwin-arm64-0.9.2.tgz", - "integrity": "sha512-YHfrBeWwwI6je3OLBK8kgxR49bLbYGLkF/HFUHjPnhZxR821zd0NNPsYMX/1Rrasx0Zpu3skhN68ofudilhHdg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/impit-darwin-x64": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/impit-darwin-x64/-/impit-darwin-x64-0.9.2.tgz", - "integrity": "sha512-FPH7gE0YdHfYRjX9qGKIvfQ6hdgo9GM+/wD1ktUC2UiEwKbwjpmrBhdXt0bSudrw9D28T4KR1w4TmX4X+uBYEA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/impit-linux-arm64-gnu": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/impit-linux-arm64-gnu/-/impit-linux-arm64-gnu-0.9.2.tgz", - "integrity": "sha512-9Va4WmklAWwjJYT5M74u6HHzmRA8Tw8tdwzsrhIBmEyJ/gzCD6TJD0sE0mgFGd8v/mEB/WfMX1VnpOQmPm1gDQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/impit-linux-arm64-musl": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/impit-linux-arm64-musl/-/impit-linux-arm64-musl-0.9.2.tgz", - "integrity": "sha512-eiZs4C4vOPRi5A/V/bNTpX9Ays1m1trMfDXRH/Bnulo7XPngP6AEGW0SaKBznfDhiFOfO7hcDPupkGvSfX5rpw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/impit-linux-x64-gnu": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/impit-linux-x64-gnu/-/impit-linux-x64-gnu-0.9.2.tgz", - "integrity": "sha512-KXkc6A0jh6c1ymxbcxgMbjNwr7YCm48froJaQWzXHg9nRSepJxprHtlWoFcz9HG/D9+eBQXTpMAJMAqXMs+NtA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/impit-linux-x64-musl": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/impit-linux-x64-musl/-/impit-linux-x64-musl-0.9.2.tgz", - "integrity": "sha512-GWXqohv79LgOF0YUP/rwVGZ4uQZWK/NJUhGZR4PgKRMb1HHH2S2wrGtSP7AHyW+GT27Tv9yrRcyidVK+FYxOVw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/impit-win32-arm64-msvc": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/impit-win32-arm64-msvc/-/impit-win32-arm64-msvc-0.9.2.tgz", - "integrity": "sha512-ta82EKAMjCXhnCs6n9jr7hzbjX3wBWhW21AdAwZEiX4RaJNmE6j0oH0ZrTZuCDJumxAV+1pJapB4q/BCuoP1IQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/impit-win32-x64-msvc": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/impit-win32-x64-msvc/-/impit-win32-x64-msvc-0.9.2.tgz", - "integrity": "sha512-S1F8b4sKYwd0FORJWir4rrU0iZbQwebY+U/lkSJOK316P46sH8wu8wHB4TLVLLNpAUI0bp4sBgXlholqtlDAQw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "Apache-2.0", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/import-fresh": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", diff --git a/package.json b/package.json index d8b631648..0edd18a05 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,6 @@ "async-parallel": "^1.2.3", "fast-glob": "^3.2.11", "flickr-sdk": "^6.0.0", - "google-img-scrap": "^1.0.6", "vue": "3.x" }, "engines": { diff --git a/tests/faces-tests.js b/tests/faces-tests.js index de2f54a7f..c13b69872 100644 --- a/tests/faces-tests.js +++ b/tests/faces-tests.js @@ -1,5 +1,4 @@ const Flickr = require('flickr-sdk') -const { GOOGLE_IMG_SCRAP , GOOGLE_QUERY } = require('google-img-scrap'); const download = require('download') const flatten = require('lodash/flatten') const execa = require('execa') @@ -10,6 +9,7 @@ const LABELS = require('./res/famous_people.json') const PHOTOS_PER_LABEL = 10 const PHOTOS_OLDER_THAN = 1627464319 // 2021-07-28; for determinism const FACE_DISTANCE_THRESHOLD = 0.42 +const flickr = new Flickr(process.env.FLICKR_API_KEY) ;(async function() { const labels = LABELS.slice(0,20) @@ -17,7 +17,7 @@ const FACE_DISTANCE_THRESHOLD = 0.42 await Parallel.each(labels, async label => { try { - let urls = await findPhotosGoogle('"' + label + '"', PHOTOS_PER_LABEL) + let urls = await findPhotos(label, PHOTOS_PER_LABEL) await Promise.all( flatten(urls).map(url => download(url, 'temp_images/' + label)) ) @@ -28,7 +28,7 @@ const FACE_DISTANCE_THRESHOLD = 0.42 }, 1) try { - let urls = await findPhotosGoogle(negativeLabel, PHOTOS_PER_LABEL * 3) + let urls = await findPhotos(negativeLabel, PHOTOS_PER_LABEL * 3) await Promise.all( flatten(urls).map(url => download(url, 'temp_images/' + negativeLabel)) ) @@ -136,20 +136,6 @@ function findPhotos(label, amount = PHOTOS_PER_LABEL) { }) } -async function findPhotosGoogle(label, amount= PHOTOS_PER_LABEL) { - console.log('GOOGLE search: '+label) - const results = await GOOGLE_IMG_SCRAP({ - search: label, - query: { - EXTENSION: GOOGLE_QUERY.EXTENSION.JPG, - SIZE: GOOGLE_QUERY.SIZE.LARGE, - }, - limit: amount, - }); - - return results.result.map(i => i.url) -} - function addVectors(a, b) { return a.map((el, i) => el + b[i]) } diff --git a/tests/landmarks-tests.js b/tests/landmarks-tests.js index 496d0d127..995bb23a9 100644 --- a/tests/landmarks-tests.js +++ b/tests/landmarks-tests.js @@ -1,5 +1,4 @@ const Flickr = require('flickr-sdk') -const { GOOGLE_IMG_SCRAP , GOOGLE_QUERY } = require('google-img-scrap'); const download = require('download') const uniq = require('lodash/uniq') const flatten = require('lodash/flatten') @@ -100,16 +99,3 @@ function findPhotos(label, amount = PHOTOS_PER_LABEL) { throw err }) } - -async function findPhotosGoogle(label, amount= PHOTOS_PER_LABEL) { - console.log('GOOGLE search: '+label) - const results = await GOOGLE_IMG_SCRAP({ - search: label, - query: { - EXTENSION: GOOGLE_QUERY.EXTENSION.JPG - }, - limit: amount, - }); - - return results.result.map(i => i.url) -}