Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
oldschoolshuffle
async function identifyAlbumsByArtistId(artistId, returnSimpleArray=true) {
//returns an array of albumIds that appear in the playlist, without duplicates
const arrayOfAlbumObjects = await spotifyApi.getArtistAlbums(artistId)
let albumIds = arrayOfAlbumObjects.items.map((albumObj) => {
if (returnSimpleArray) {
return albumObj.id
} else {
return ({albumId: albumObj.id, albumName: albumObj.name, albumUri: albumObj.uri})
}
})
albumIds = uniq(albumIds);
albumIds = shuffleArray(albumIds);
return albumIds;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.