ISRC在Apple Music/iTunes中的查找歌曲 [英] Lookup song by ISRC in Apple Music/iTunes

查看:367
本文介绍了ISRC在Apple Music/iTunes中的查找歌曲的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个iOS应用程序,该程序可从外部来源检索歌曲 ISRC .然后,我需要使用ISRC在Apple Music/iTunes中使用Apple的MusicKit SDK来获取歌曲.是否有可能做到这一点?

I'm developing an iOS application which retrieves a song ISRC from an external source. I then need to use Apple's MusicKit SDK to get the song in Apple Music/iTunes, using the ISRC. Is it possible to do this? The Song resource type has the ISRC in the song attributes which is returned whn you do a GET request for a song, but the request uses the Apple Music song ID to perform the lookup. So can I query Apple Music for a song, using the ISRC instead? Also happy to look it up on the iTunes Search API and then get the ID (I think they're the same across Apple Music and iTunes?) and then query the Apple Music API using that ID.

我还在Apple Developer MusicKit论坛上问了这个问题,但截至但是,没有人回答我.

I also asked this question on the Apple Developer MusicKit forum, but as of yet, no-one has answered me.

推荐答案

在WWDC 2018上刚刚强调了这一点.您可以直接向

This was just highlighted at WWDC 2018. You can perform an request directly to the Apple Music API to

GET https://api.music.apple.com/v1/catalog/{storefront}/songs?filter[isrc]=ISRCSTRING

如果您正在使用新的 MusicKit JS 库,则可以使用以下代码执行查找JavaScript:

If you are using the new MusicKit JS library, you can perform the lookup with the following JavaScript:

MusicKit.getInstance().api.songs({ filter: { isrc: 'ISRCSTRING' } }).then(function(songs) {
    console.log(songs); // Array of songs matching ISRCSTRING
})

这篇关于ISRC在Apple Music/iTunes中的查找歌曲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆