mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 02:31:45 +00:00
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:
@ -69,8 +69,12 @@ export default async (win_: BrowserWindow) => {
|
|||||||
win = win_;
|
win = win_;
|
||||||
injectCSS(win.webContents, join(__dirname, 'style.css'));
|
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({
|
yt = await Innertube.create({
|
||||||
cache: new UniversalCache(false),
|
cache: new UniversalCache(false),
|
||||||
|
cookie,
|
||||||
generate_session_locally: true,
|
generate_session_locally: true,
|
||||||
});
|
});
|
||||||
ipcMain.on('download-song', (_, url: string) => downloadSong(url));
|
ipcMain.on('download-song', (_, url: string) => downloadSong(url));
|
||||||
|
|||||||
Reference in New Issue
Block a user