| 523 | }; |
| 524 | |
| 525 | const fetchTrack = async (uri, uid, context) => { |
| 526 | const base62 = uri.split(":")[2]; |
| 527 | const res = await CosmosAsync.get(`https://api.spotify.com/v1/tracks/${base62}`); |
| 528 | let newContext; |
| 529 | if (context && uid && Spicetify.URI.isPlaylistV1OrV2(context)) { |
| 530 | newContext = `${Spicetify.URI.fromString(context).toURLPath(true)}?uid=${uid}`; |
| 531 | } |
| 532 | return { |
| 533 | uri, |
| 534 | title: res.name, |
| 535 | description: res.artists[0].name, |
| 536 | imageUrl: res.album.images[0].url, |
| 537 | context: newContext ?? context, |
| 538 | }; |
| 539 | }; |
| 540 | |
| 541 | const fetchEpisode = async (uri) => { |
| 542 | const base62 = uri.split(":")[2]; |