…lines 1–4 unchanged (4 lines)
5import { app, type BrowserWindow, dialog, ipcMain } from 'electron';
6import {
7 Innertube,
8 UniversalCache,
9 Utils,
10 YTNodes,
11 Platform,
12} from '\u0079\u006f\u0075\u0074\u0075\u0062\u0065i.js';
13import is from 'electron-is';
14import filenamify from 'filenamify';
15import { Mutex } from 'async-mutex';
16import * as NodeID3 from 'node-id3';
17import { BG, type BgConfig } from 'bgutils-js';
…lines 18–54 unchanged (37 lines)
55 logger() {}, // Console.log,
56 progress() {}, // Console.log,
57 }),
58);
59const ffmpegMutex = new Mutex();
60
61Platform.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
77let yt: Innertube;
78let win: BrowserWindow;
79let playingUrl: string;
80
81const isPremium = async () => {
…lines 82–144 unchanged (63 lines)
145}: BackendContext<DownloaderPluginConfig>) => {
146 win = _win;
147 config = await getConfig();
148
149 yt = await Innertube.create({
150 cache: new UniversalCache(false),
151 cookie: await getCookieFromWindow(win),
152 generate_session_locally: true,
153 fetch: getNetFetchAsFetch(),
154 });
155
156 const requestKey = 'O43z0dpjhgX20SCx4KAo';
157 const visitorData = yt.session.context.client.visitorData;
…lines 158–878 unchanged (721 lines)