Skip to content

Conversation

@trevin-j
Copy link

@trevin-j trevin-j commented Nov 6, 2025

TLDR; the only way to fix the downloader is to upgrade youtubei.js to version 16 and specify a js interpreter.

As this comment says, the current hardcoded player id (from #3973) doesn't work anymore. At the moment, the downloader plugin won't work.

I upgraded youtubei.js to version 16, added in the snippet shown here (specifying a js interpreter), and got the downloads to work again.

Changes:

  • Remove hard-coded player_id
    • The specific player_id is blocked now
  • Update youtubei.js dependency to version 16 (fixes download issues)
  • Specify js interpreter for sig function stuff

* Remove hard-coded player_id
  * The specific player_id is blocked now
* Update youtubei.js dependency to version 16 (fixes download issues)
* Specify js interpreter for sig function stuff
);
const ffmpegMutex = new Mutex();

Platform.shim.eval = async (data: Types.BuildScriptResult, env: Record<string, Types.VMPrimative>) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace data:·Types.BuildScriptResult,·env:·Record<string,·Types.VMPrimative> with ⏎··data:·Types.BuildScriptResult,⏎··env:·Record<string,·Types.VMPrimative>,⏎

Suggested change
Platform.shim.eval = async (data: Types.BuildScriptResult, env: Record<string, Types.VMPrimative>) => {
Platform.shim.eval = async (
data: Types.BuildScriptResult,
env: Record<string, Types.VMPrimative>,
) => {

);
const ffmpegMutex = new Mutex();

Platform.shim.eval = async (data: Types.BuildScriptResult, env: Record<string, Types.VMPrimative>) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <@typescript-eslint/require-await> reported by reviewdog 🐶
Async arrow function has no 'await' expression.

Platform.shim.eval = async (data: Types.BuildScriptResult, env: Record<string, Types.VMPrimative>) => {
const properties = [];

if(env.n) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert ·

Suggested change
if(env.n) {
if (env.n) {

const properties = [];

if(env.n) {
properties.push(`n: exportedVars.nFunction("${env.n}")`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert ;

Suggested change
properties.push(`n: exportedVars.nFunction("${env.n}")`)
properties.push(`n: exportedVars.nFunction("${env.n}")`);

const properties = [];

if(env.n) {
properties.push(`n: exportedVars.nFunction("${env.n}")`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <stylistic/semi> reported by reviewdog 🐶
Missing semicolon.

Suggested change
properties.push(`n: exportedVars.nFunction("${env.n}")`)
properties.push(`n: exportedVars.nFunction("${env.n}")`);


const code = `${data.output}\nreturn { ${properties.join(', ')} }`;

return new Function(code)();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <@typescript-eslint/no-unsafe-return> reported by reviewdog 🐶
Unsafe return of a value of type any.


const code = `${data.output}\nreturn { ${properties.join(', ')} }`;

return new Function(code)();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <@typescript-eslint/no-implied-eval> reported by reviewdog 🐶
Implied eval. Do not use the Function constructor to create functions.


const code = `${data.output}\nreturn { ${properties.join(', ')} }`;

return new Function(code)();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <@typescript-eslint/no-unsafe-call> reported by reviewdog 🐶
Unsafe call of a(n) Function typed value.

const code = `${data.output}\nreturn { ${properties.join(', ')} }`;

return new Function(code)();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert ;

Suggested change
}
};

const code = `${data.output}\nreturn { ${properties.join(', ')} }`;

return new Function(code)();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <stylistic/semi> reported by reviewdog 🐶
Missing semicolon.

Suggested change
}
};

@rabid-sausage
Copy link

I can confirm this works, manually applied the changes and built a working version and can now download without issue.
Myself prior to reading this, I got as far as upgrading youtubei.js to 16 and including meriyah, but could not wok out what to do with the required script, where to insert it, but can see from what you have done it was actually rather simple (still do not know what the script does). The Player ID fix was a quick get-around a bigger problem, found that out on other groups who first offered the Player ID solution.

Thanks for you effort and showing what you have done.

It will be interesting to see if this get pushed in to the next build, as it looks like some parties like youtubei.js, projects that use their code and others which operate similar are now not including this type of function in pre-compiled downloads, requiring individual users to manually insert/adjust the code and build a working copy themselves to gain this and other functions. Maybe a method avoiding getting in to trouble directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants