mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-15 20:31:46 +00:00
feat: migration to TypeScript part 2
Co-authored-by: Su-Yong <simssy2205@gmail.com>
This commit is contained in:
15
plugins/crossfade/back.ts
Normal file
15
plugins/crossfade/back.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { ipcMain } from 'electron';
|
||||
import { Innertube } from 'youtubei.js';
|
||||
|
||||
import config from './config';
|
||||
|
||||
export default async () => {
|
||||
const yt = await Innertube.create();
|
||||
|
||||
ipcMain.handle('audio-url', async (_, videoID: string) => {
|
||||
const info = await yt.getBasicInfo(videoID);
|
||||
const url = info.streaming_data?.formats[0].decipher(yt.session.player);
|
||||
|
||||
return url;
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user