Skip to content

exportedVars.nFunction is not a function #1146

@Positive2022

Description

@Positive2022

Steps to reproduce

I am suddenly getting this error whenever I initialize my innertube client
This is my code:

File where I initialise my Innertube client

Platform.shim.eval = async (data, env) => {
    const properties = [];

    if (env.n) properties.push(`n: exportedVars.nFunction("${env.n}")`);
    if (env.sig) properties.push(`sig: exportedVars.sigFunction("${env.sig}")`);

    const code = `${data.output}\nreturn { ${properties.join(", ")} }`;
    return new Function(code)();
};

async function getYTInstance() {
         const inst = await Innertube.create({ cache: new UniversalCache(true), client_type: ClientType.TV_EMBEDDED });
        inst.session.on(...)
            await inst.session.signIn(); // WAIT for this to finish
            await inst.session.oauth.cacheCredentials();
}

Code which uses Innertube

const getYTInstance = require('./getYTInstance');
module.exports = async (videoId) => {
  const ytInstance = await getYTInstance();
  const audio = await ytInstance.getStreamingData(videoId, { client: "TV" });
  return audio;
};

Failure Logs

15|omniv31   | Trace: TypeError: exportedVars.nFunction is not a function
15|omniv31   |     at eval (eval at Platform.shim.eval (/mnt/data/omniv31/sources/youtube/getYTInstance.js:12:12), <anonymous>:16:26)
15|omniv31   |     at Platform.shim.eval (/mnt/data/omniv31/sources/youtube/getYTInstance.js:12:30)
15|omniv31   |     at Player.decipher (file:///mnt/data/omniv31/node_modules/youtubei.js/dist/src/core/Player.js:109:52)
15|omniv31   |     at Format.decipher (file:///mnt/data/omniv31/node_modules/youtubei.js/dist/src/parser/classes/misc/Format.js:175:23)
15|omniv31   |     at Innertube.getStreamingData (file:///mnt/data/omniv31/node_modules/youtubei.js/dist/src/Innertube.js:347:35)
15|omniv31   |     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Expected behavior

No error should be there.

Current behavior

1 | Trace: TypeError: exportedVars.nFunction is not a function

Version

Default

Anything else?

No response

Checklist

  • I am running the latest version.
  • I checked the documentation and found no answer.
  • I have searched the existing issues and made sure this is not a duplicate.
  • I have provided sufficient information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions