Version 2.0.0 - update of everything

This commit is contained in:
raphix committed 2026-10-07 14:04:26 +02:00
1 parent 164a1da009
commit 6017e03eac
85 files changed
+13065 -2107

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
// Test de getYouTubeProfilePicture (non exportée) : module recompilé avec une exportation de test
const path = require("path"), fs = require("fs"), Module = require("module"), assert = require("assert");
const SRC = require("path").resolve(__dirname, "../../src");
require(path.join(SRC, "../node_modules/loguix")).setup(path.join(__dirname, "logs"), path.join(SRC, "../package.json"));
const file = path.join(SRC, "media/YoutubeInformation.js");
const m = new Module(file, module); m.filename = file; m.paths = Module._nodeModulePaths(path.dirname(file));
m._compile(fs.readFileSync(file, "utf8") + "\nmodule.exports.__avatar = getYouTubeProfilePicture;", file);
const get = m.exports.__avatar;
(async () => {
let t = Date.now();
const a1 = await get("https://www.youtube.com/@aftkt");
console.log("avatar #1:", Date.now() - t, "ms", a1);
assert.ok(a1 && a1.startsWith("https://"));
t = Date.now();
const a2 = await get("https://www.youtube.com/@aftkt");
console.log("avatar #2 (cache):", Date.now() - t, "ms");
assert.strictEqual(a2, a1); assert.ok(Date.now() - t < 20);
assert.strictEqual(await get("https://evil.example.com/@x"), null);
assert.strictEqual(await get("https://www.youtube.com/channel/undefined"), null);
assert.strictEqual(await get(undefined), null);
console.log("OK");
})().catch(e => { console.error("ÉCHEC", e); process.exit(1); });