mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-17 13:12:07 +00:00
fix(downloader): fix #2769
This commit is contained in:
@ -63,6 +63,11 @@ let yt: Innertube;
|
|||||||
let win: BrowserWindow;
|
let win: BrowserWindow;
|
||||||
let playingUrl: string;
|
let playingUrl: string;
|
||||||
|
|
||||||
|
const isYouTubePremium = () =>
|
||||||
|
win.webContents.executeJavaScript(
|
||||||
|
'!document.querySelector(\'#endpoint[href="/music_premium"]\')',
|
||||||
|
) as Promise<boolean>;
|
||||||
|
|
||||||
const sendError = (error: Error, source?: string) => {
|
const sendError = (error: Error, source?: string) => {
|
||||||
win.setProgressBar(-1); // Close progress bar
|
win.setProgressBar(-1); // Close progress bar
|
||||||
setBadge(0); // Close badge
|
setBadge(0); // Close badge
|
||||||
@ -313,7 +318,7 @@ async function downloadSongUnsafe(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const downloadOptions: FormatOptions = {
|
const downloadOptions: FormatOptions = {
|
||||||
type: 'audio', // Audio, video or video+audio
|
type: (await isYouTubePremium()) ? 'audio' : 'video+audio', // Audio, video or video+audio
|
||||||
quality: 'best', // Best, bestefficiency, 144p, 240p, 480p, 720p and so on.
|
quality: 'best', // Best, bestefficiency, 144p, 240p, 480p, 720p and so on.
|
||||||
format: 'any', // Media container format
|
format: 'any', // Media container format
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user