fix(plugins/music): spotify playlist mode
This commit is contained in:
@@ -124,14 +124,14 @@ export default async function({login, imports, data, q, account}, {enabled = fal
|
|||||||
//Spotify
|
//Spotify
|
||||||
case "spotify": {
|
case "spotify": {
|
||||||
//Parse tracklist
|
//Parse tracklist
|
||||||
await frame.waitForSelector("table")
|
await frame.waitForSelector("ol")
|
||||||
tracks = [
|
tracks = [
|
||||||
...await frame.evaluate(() =>
|
...await frame.evaluate(() =>
|
||||||
[...document.querySelectorAll("table tr")].map(tr => ({
|
[...document.querySelectorAll("ol li")].map(tr => ({
|
||||||
name: tr.querySelector("td:nth-child(2) div div:nth-child(1)").innerText,
|
name: tr.querySelector("h3").innerText,
|
||||||
artist: tr.querySelector("td:nth-child(2) div div:nth-child(2)").innerText,
|
artist: tr.querySelector("h4").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 ?? document.querySelector("button").parentNode, null).backgroundImage.match(/^url\("(?<url>https:...+)"\)$/)?.groups?.url ?? null,
|
artwork: window.getComputedStyle(document.querySelector("div[style^='--image-src:']") ?? null)?.backgroundImage.match(/^url\("(?<url>https:...+)"\)$/)?.groups?.url ?? null,
|
||||||
}))
|
}))
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user