Skip to content

Commit 4fba3ff

Browse files
authored
fix(downloader): update youtubei.js and remove player_id (#4069)
1 parent bef8252 commit 4fba3ff

File tree

3 files changed

+40
-21
lines changed

3 files changed

+40
-21
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
"virtua": "0.42.3",
135135
"vudio": "2.1.1",
136136
"x11": "2.3.0",
137-
"youtubei.js": "15.0.1",
137+
"youtubei.js": "^16.0.1",
138138
"zod": "4.1.5"
139139
},
140140
"devDependencies": {

pnpm-lock.yaml

Lines changed: 22 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/plugins/downloader/main/index.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
UniversalCache,
99
Utils,
1010
YTNodes,
11+
Platform,
1112
} from '\u0079\u006f\u0075\u0074\u0075\u0062\u0065i.js';
1213
import is from 'electron-is';
1314
import filenamify from 'filenamify';
@@ -57,6 +58,22 @@ const ffmpeg = lazy(async () =>
5758
);
5859
const ffmpegMutex = new Mutex();
5960

61+
Platform.shim.eval = async (data: Types.BuildScriptResult, env: Record<string, Types.VMPrimative>) => {
62+
const properties = [];
63+
64+
if(env.n) {
65+
properties.push(`n: exportedVars.nFunction("${env.n}")`)
66+
}
67+
68+
if (env.sig) {
69+
properties.push(`sig: exportedVars.sigFunction("${env.sig}")`)
70+
}
71+
72+
const code = `${data.output}\nreturn { ${properties.join(', ')} }`;
73+
74+
return new Function(code)();
75+
}
76+
6077
let yt: Innertube;
6178
let win: BrowserWindow;
6279
let playingUrl: string;
@@ -131,7 +148,6 @@ export const onMainLoad = async ({
131148

132149
yt = await Innertube.create({
133150
cache: new UniversalCache(false),
134-
player_id: '0004de42',
135151
cookie: await getCookieFromWindow(win),
136152
generate_session_locally: true,
137153
fetch: getNetFetchAsFetch(),

0 commit comments

Comments
 (0)