我目前正在使用非常酷的应用程序 Exportify ( https://github.com/watsonbox/exportify ) 将 Spotify 播放列表导出到 CSV。
我的 javascript 知识很糟糕,但我目前正在尝试包含每首轨道的类型,但我无法检索它。
我假设:
我可以通过添加来获取艺术家 ID
item.track.artists.map(function (artist) {
return artist.id
}).join(', '),
到
exportify.js
下面的代码文件。var tracks = responses.map(function (response) {
return response.items.map(function (item) {
return [
item.track.uri,
item.track.id,
item.track.name,
item.track.artists.map(function (artist) {
return artist.name
}).join(', '),
item.track.artists.map(function (artist) {
return artist.id
}).join(', '),
item.track.album.name,
item.track.disc_number,
item.track.track_number,
item.track.duration_ms,
item.added_by == null ? '' : item.added_by.uri,
item.added_at
].map(function (track) {
return '"' + track + '"';
})
});
});
谁能告诉我如何根据艺术家 ID 获取艺术家类型并将其添加为另一列?
谢谢
克里斯
最佳答案
在 Spotify 中使用“Get an Artist”端点:
https://developer.spotify.com/web-api/get-artist/
调用此端点将为您提供给定艺术家 ID 的艺术家的流派。
关于javascript - Spotify javascript API - 获取播放列表中歌曲的类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41224070/