1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Scrobbler now supports YT Music multiple artists

This commit is contained in:
Krateng 2019-05-05 14:11:27 +02:00
parent 54bef3e8c2
commit 451e8c1519

View File

@ -10,7 +10,14 @@ metadata = bar.querySelector("div[class*=middle-controls] > div[class*=content-i
ctrl = bar.querySelector("div[class*=left-controls]")
title = metadata.querySelector("yt-formatted-string[class*=title]").getAttribute("title")
artist = metadata.querySelector("span > span[class*=subtitle] > yt-formatted-string > a:nth-child(1)").innerHTML
artistlist = metadata.querySelector("span > span[class*=subtitle] > yt-formatted-string")
artistelements = artistlist.getElementsByTagName("a")
artists = []
for (var i=0;i<artistelements.length-1;i++) {
artists.push(artistelements[i].innerHTML)
}
//artist = metadata.querySelector("span > span[class*=subtitle] > yt-formatted-string > a:nth-child(1)").innerHTML
artist = artists.join(";");
duration = ctrl.querySelector("[class*=time-info]").innerHTML.split("/")[1]
if (duration.split(":").length == 2) {
durationSeconds = parseInt(duration.split(":")[0]) * 60 + parseInt(duration.split(":")[1])