mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-15 04:11:47 +00:00
minimize getArtist()
This commit is contained in:
@ -30,15 +30,11 @@ const getPausedStatus = async (win) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getArtist = async (win) => {
|
const getArtist = async (win) => {
|
||||||
return await win.webContents.executeJavaScript(
|
return await win.webContents.executeJavaScript(`
|
||||||
`
|
document.querySelector(".subtitle.ytmusic-player-bar")
|
||||||
var bar = document.getElementsByClassName('subtitle ytmusic-player-bar')[0];
|
?.querySelector(".yt-formatted-string")
|
||||||
var artistName = (bar.getElementsByClassName('yt-formatted-string')[0]) || (bar.getElementsByClassName('byline ytmusic-player-bar')[0]);
|
?.textContent
|
||||||
if (artistName) {
|
`);
|
||||||
artistName.textContent;
|
|
||||||
}
|
|
||||||
`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill songInfo with empty values
|
// Fill songInfo with empty values
|
||||||
@ -66,6 +62,8 @@ const handleData = async (responseText, win) => {
|
|||||||
songInfo.uploadDate = data?.microformat?.microformatDataRenderer?.uploadDate;
|
songInfo.uploadDate = data?.microformat?.microformatDataRenderer?.uploadDate;
|
||||||
songInfo.url = data?.microformat?.microformatDataRenderer?.urlCanonical;
|
songInfo.url = data?.microformat?.microformatDataRenderer?.urlCanonical;
|
||||||
|
|
||||||
|
console.log("updating song-info");
|
||||||
|
|
||||||
win.webContents.send("update-song-info", JSON.stringify(songInfo));
|
win.webContents.send("update-song-info", JSON.stringify(songInfo));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user