mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
14 lines
368 B
JavaScript
14 lines
368 B
JavaScript
const { ipcMain } = require("electron");
|
|
const { Innertube } = require("youtubei.js");
|
|
|
|
module.exports = async (win, options) => {
|
|
const yt = await Innertube.create();
|
|
|
|
ipcMain.handle("audio-url", async (_, videoID) => {
|
|
const info = await yt.getBasicInfo(videoID);
|
|
const url = info.streaming_data?.formats[0].decipher(yt.session.player);
|
|
|
|
return url;
|
|
});
|
|
};
|