2

I'm looking for API that would allow do these tasks

  • Search song in Apple Music
  • Create playlist
  • Add songs to playlist

Thanks in advance.

aleroot
  • 71,077
  • 30
  • 176
  • 213
Andrew Square
  • 393
  • 1
  • 4
  • 13

1 Answers1

3

I'm afraid that what you are asking to do, is at the moment not possible since starting from iTunes 12.2 we can only search the local library and not the entire Apple Music from the API.

In the case you have the song that you want to play inside your library(local or cloud), you can search and play a song like this :

tell application "iTunes"
    set results to (every track whose name contains "Cumuli" and artist is "883")
    repeat with tune in results
        play tune
    end repeat
end tell

And then you can put the retrieved tune inside the playlist you want, or create a new one. Take a look at this post for an example.

aleroot
  • 71,077
  • 30
  • 176
  • 213