← back to Elitis Price 2026
exec/extract_nuxt.js
33 lines
// Reads an elitis.fr __NUXT__ IIFE blob on stdin, evals it in a sandboxed window,
// walks for pattern nodes ({name, images:[{cachedPath|path}]}) and prints ONE
// JSON array to stdout. $0 (local node). No network.
let blob = "";
process.stdin.on("data", d => (blob += d));
process.stdin.on("end", () => {
try {
globalThis.window = {};
// eslint-disable-next-line no-eval
(0, eval)("window.__NUXT__=" + blob);
const acc = [];
const seen = new Set();
(function walk(o) {
if (o && typeof o === "object") {
if (o.name && Array.isArray(o.images) && o.images.length) {
const imgs = o.images
.map(x => (x && (x.cachedPath || x.path)) || null)
.filter(Boolean);
const key = o.slug + "|" + o.name + "|" + imgs.length;
if (imgs.length && !seen.has(key)) {
seen.add(key);
acc.push({ name: o.name, slug: o.slug || null, n: imgs.length, images: imgs });
}
}
for (const k in o) { try { walk(o[k]); } catch (e) {} }
}
})(window.__NUXT__);
process.stdout.write(JSON.stringify(acc));
} catch (e) {
process.stdout.write(JSON.stringify({ error: String(e).slice(0, 200) }));
}
});