chore: url improvements
This commit is contained in:
parent
1e60b29d30
commit
17367d7b77
1 changed files with 7 additions and 5 deletions
|
@ -31,7 +31,7 @@ module.exports = async function () {
|
||||||
while (CURRENT_PAGE < PAGES) {
|
while (CURRENT_PAGE < PAGES) {
|
||||||
const URL = `https://api.music.apple.com/v1/me/recent/played/tracks?limit=${PAGE_SIZE}&offset=${
|
const URL = `https://api.music.apple.com/v1/me/recent/played/tracks?limit=${PAGE_SIZE}&offset=${
|
||||||
PAGE_SIZE * CURRENT_PAGE
|
PAGE_SIZE * CURRENT_PAGE
|
||||||
}`
|
}&include[songs]=albums&extend=artistUrl`
|
||||||
const tracks = await fetch(URL, {
|
const tracks = await fetch(URL, {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
@ -52,7 +52,9 @@ module.exports = async function () {
|
||||||
image: `https://cdn.coryd.dev/artists/${track['attributes']['artistName']
|
image: `https://cdn.coryd.dev/artists/${track['attributes']['artistName']
|
||||||
.replace(/\s+/g, '-')
|
.replace(/\s+/g, '-')
|
||||||
.toLowerCase()}.jpg`,
|
.toLowerCase()}.jpg`,
|
||||||
url: `https://musicbrainz.org/search?query=${track['attributes']['artistName'].replace(
|
url: track['attributes']['artistUrl']
|
||||||
|
? track['attributes']['artistUrl']
|
||||||
|
: `https://musicbrainz.org/search?query=${track['attributes']['artistName'].replace(
|
||||||
/\s+/g,
|
/\s+/g,
|
||||||
'+'
|
'+'
|
||||||
)}&type=artist`,
|
)}&type=artist`,
|
||||||
|
|
Reference in a new issue