Fix html selector for spotify suggested tracks #202

This commit is contained in:
lowlighter
2021-03-28 12:32:57 +02:00
parent 1b844ae244
commit ec80d0d74c

View File

@@ -98,8 +98,8 @@
//Parse tracklist //Parse tracklist
await frame.waitForSelector("table") await frame.waitForSelector("table")
tracks = [...await frame.evaluate(() => [...document.querySelectorAll("table tr")].map(tr => ({ tracks = [...await frame.evaluate(() => [...document.querySelectorAll("table tr")].map(tr => ({
name:tr.querySelector("td:nth-child(2) div:nth-child(1)").innerText, name:tr.querySelector("td:nth-child(2) div div:nth-child(1)").innerText,
artist:tr.querySelector("td:nth-child(2) div:nth-child(2)").innerText, artist:tr.querySelector("td:nth-child(2) div div:nth-child(2)").innerText,
//Spotify doesn't provide artworks so we fallback on playlist artwork instead //Spotify doesn't provide artworks so we fallback on playlist artwork instead
artwork:window.getComputedStyle(document.querySelector("button[title=Play]").parentNode, null).backgroundImage.match(/^url\("(?<url>https:...+)"\)$/)?.groups?.url ?? null, artwork:window.getComputedStyle(document.querySelector("button[title=Play]").parentNode, null).backgroundImage.match(/^url\("(?<url>https:...+)"\)$/)?.groups?.url ?? null,
})))] })))]