From 832ff19e513f83c17f2bf94b270cc423f30e520d Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Sat, 3 Apr 2021 05:38:21 +0300 Subject: [PATCH] allows downloading song that aren't playing --- plugins/downloader/front.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/downloader/front.js b/plugins/downloader/front.js index 17b2846b..bf62e2d2 100644 --- a/plugins/downloader/front.js +++ b/plugins/downloader/front.js @@ -31,11 +31,16 @@ const reinit = () => { } }; +const baseUrl = "https://music.youtube.com"; // TODO: re-enable once contextIsolation is set to true // contextBridge.exposeInMainWorld("downloader", { // download: () => { global.download = () => { - const videoUrl = global.songInfo.url || window.location.href; + let videoUrl = getSongMenu() + .querySelector("ytmusic-menu-navigation-item-renderer") + .querySelector("#navigation-endpoint") + .getAttribute("href"); + videoUrl = !videoUrl ? (global.songInfo.url || window.location.href) : (baseUrl + videoUrl); downloadVideoToMP3( videoUrl,