mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 19:31:46 +00:00
fix metadata when downloading unplayed song
This commit is contained in:
@ -38,13 +38,18 @@ const baseUrl = defaultConfig.url;
|
||||
// contextBridge.exposeInMainWorld("downloader", {
|
||||
// download: () => {
|
||||
global.download = () => {
|
||||
let metadata;
|
||||
let videoUrl = getSongMenu()
|
||||
.querySelector("ytmusic-menu-navigation-item-renderer")
|
||||
.querySelector("#navigation-endpoint")
|
||||
.getAttribute("href");
|
||||
videoUrl = !videoUrl
|
||||
? global.songInfo.url || window.location.href
|
||||
: baseUrl + "/" + videoUrl;
|
||||
if (videoUrl) {
|
||||
videoUrl = baseUrl + "/" + videoUrl;
|
||||
metadata = null;
|
||||
} else {
|
||||
videoUrl = global.songInfo.url || window.location.href;
|
||||
metadata = global.songInfo;
|
||||
}
|
||||
|
||||
downloadVideoToMP3(
|
||||
videoUrl,
|
||||
@ -61,7 +66,7 @@ global.download = () => {
|
||||
},
|
||||
reinit,
|
||||
pluginOptions,
|
||||
global.songInfo
|
||||
metadata
|
||||
);
|
||||
};
|
||||
// });
|
||||
|
||||
Reference in New Issue
Block a user