fix: downloader

For example, in South Korea, YouTube Music is only available to YT premium users.
Therefore, calling getInfo without passing a cookie will always return `UNPLAYABLE`.
This commit is contained in:
JellyBrick
2023-09-04 18:01:54 +09:00
parent ce264c5d65
commit 451d33707a

View File

@ -69,8 +69,12 @@ export default async (win_: BrowserWindow) => {
win = win_;
injectCSS(win.webContents, join(__dirname, 'style.css'));
const cookie = (await win.webContents.session.cookies.get({ url: 'https://music.youtube.com' })).map((it) =>
it.name + '=' + it.value + ';'
).join('');
yt = await Innertube.create({
cache: new UniversalCache(false),
cookie,
generate_session_locally: true,
});
ipcMain.on('download-song', (_, url: string) => downloadSong(url));