mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 12:42:06 +00:00
Merge pull request #221 from Araxeus/download-song-that-isnt-playing
Allows downloading songs that aren't currently playing
This commit is contained in:
@ -31,11 +31,16 @@ const reinit = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const baseUrl = "https://music.youtube.com";
|
||||||
// TODO: re-enable once contextIsolation is set to true
|
// TODO: re-enable once contextIsolation is set to true
|
||||||
// contextBridge.exposeInMainWorld("downloader", {
|
// contextBridge.exposeInMainWorld("downloader", {
|
||||||
// download: () => {
|
// download: () => {
|
||||||
global.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(
|
downloadVideoToMP3(
|
||||||
videoUrl,
|
videoUrl,
|
||||||
|
|||||||
Reference in New Issue
Block a user