diff --git a/api/package.json b/api/package.json index c8e8319a..44aa2b77 100644 --- a/api/package.json +++ b/api/package.json @@ -40,7 +40,7 @@ "set-cookie-parser": "2.7.2", "undici": "^6.22.0", "url-pattern": "1.0.3", - "youtubei.js": "16.0.1", + "youtubei.js": "17.0.1", "zod": "^4.2.1" }, "optionalDependencies": { diff --git a/api/src/processing/services/youtube.js b/api/src/processing/services/youtube.js index 0279a9c9..55385971 100644 --- a/api/src/processing/services/youtube.js +++ b/api/src/processing/services/youtube.js @@ -9,24 +9,12 @@ import { getCookie } from "../cookie/manager.js"; import { getYouTubeSession } from "../helpers/youtube-session.js"; // https://github.com/LuanRT/YouTube.js/pull/1052 -Platform.shim.eval = async (data, envData) => { +Platform.shim.eval = async (data) => { const isolate = new ivm.Isolate(); try { const context = await isolate.createContext(); - const jail = context.global; - const properties = []; - - if (envData.n) { - await jail.set('__n_input', envData.n); - properties.push('n: exportedVars.nFunction(__n_input)'); - } - if (envData.sig) { - await jail.set('__sig_input', envData.sig); - properties.push('sig: exportedVars.sigFunction(__sig_input)'); - } - - const code = `${data.output}\n({ ${properties.join(', ')} })`; + const code = `(() => { ${data.output} })()`; const script = await isolate.compileScript(code); return await script.run(context, { copy: true, timeout: 5000 }); } finally { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 220e50fe..72738c5a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -62,8 +62,8 @@ importers: specifier: 1.0.3 version: 1.0.3 youtubei.js: - specifier: 16.0.1 - version: 16.0.1 + specifier: 17.0.1 + version: 17.0.1 zod: specifier: ^4.2.1 version: 4.2.1 @@ -2114,8 +2114,8 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} - youtubei.js@16.0.1: - resolution: {integrity: sha512-3802bCAGkBc2/G5WUTc0l/bO5mPYJbQAHL04d9hE9PnrDHoBUT8MN721Yqt4RCNncAXdHcfee9VdJy3Fhq1r5g==} + youtubei.js@17.0.1: + resolution: {integrity: sha512-1lO4b8UqMDzE0oh2qEGzbBOd4UYRdxn/4PdpRM7BGTHxM6ddsEsKZTu90jp8V9FHVgC2h1UirQyqoqLiKwl+Zg==} zimmerframe@1.1.2: resolution: {integrity: sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w==} @@ -3945,7 +3945,7 @@ snapshots: yocto-queue@0.1.0: {} - youtubei.js@16.0.1: + youtubei.js@17.0.1: dependencies: '@bufbuild/protobuf': 2.2.5 meriyah: 6.1.4