6

I am currently trying to read all of a users Library Playlists. What I need are the following: Id,Name,Description,Songs and Artwork. The Endpoint "https://api.music.apple.com/v1/me/library/playlists?limit=100" returns the following response:

{
  "data": [
    {
      "id": "p.oOzAa4gIlaQaBVx",
      "type": "library-playlists",
      "href": "\/v1\/me\/library\/playlists\/p.oOzAa4gIlaQaBVx",
      "attributes": {
        "name": "Drake",
        "description": {
          "standard": ""
        },
        "hasCatalog": true,
        "canEdit": true,
        "playParams": {
          "id": "p.oOzAa4gIlaQaBVx",
          "kind": "playlist",
          "isLibrary": true,
          "globalId": "pl.u-Zmblx9rU02m2DXJ"
        },
        "dateAdded": "2017-10-30T21:39:45Z"
      }
    },
etc...

As you can see the Artwork Attribute is non-existent despite the API documentation specifying artwork as an attribute (https://developer.apple.com/documentation/applemusicapi/libraryplaylist/attributes) I tried using ?include=artwork even though it's an attribute and not a relationship but that didn't work. Any ideas how I can retrieve the artwork? If I can't get it from the apple music API is there any other way I could get the artwork? I've been stuck on this for a while so any help is appreciated!

barbecu
  • 684
  • 10
  • 28

3 Answers3

0

I've looked a bit and I think you're mistaken. The doc actually says that the response of https://api.music.apple.com/v1/me/library/playlists doesn't have an artwork attribute, have a look here

You can probably find the Artwork with the response of your first call and using it in this one https://api.music.apple.com/v1/catalog/{storefront}/playlists/{id}, here the doc.

Biscuit
  • 4,840
  • 4
  • 26
  • 54
  • The response doesn't have one but the object is listed as having one [link](https://developer.apple.com/documentation/applemusicapi/libraryplaylist/attributes) Which means theoretically I should be able to retrieve the artwork, also I don't think the catalog call will work since the playlists are library playlists and they aren't public. – barbecu Mar 25 '20 at 21:14
  • No, the attribute isn't required so it's possible that for some response it doesn't exists. There is also this [page](https://developer.apple.com/documentation/applemusicapi/get_a_library_playlist) but I don't see how you retrieve the songs inside the playlist – Biscuit Mar 25 '20 at 21:23
  • So how can I get the artwork for a library playlist? – barbecu Mar 25 '20 at 22:17
  • It seems that you can add a query parameter called `include` in the last link I gave you which is a [`LibraryPlaylist.Relationships`](https://developer.apple.com/documentation/applemusicapi/libraryplaylist/relationships) and this gives you the result of the song in the library and there is chance that the artwork is in it. – Biscuit Mar 25 '20 at 22:34
  • I'm having some problems with my Apple Authentication SDK, Is there any chance you could check it out and try? – barbecu Mar 29 '20 at 15:36
  • I don't have account on apple music :/ – Biscuit Mar 29 '20 at 15:46
  • I checked and the playlist artwork isn't in the response :( – barbecu Apr 12 '20 at 14:19
0

I have been working to fetch playlist "global id" in API at the moment, I found there are some catalog values not available in public.

When I was trying to fetch global id for each playlist some have and others doesn't not exist.
If the "hascatalog" = true, will be able to get all the Json string values. Incase "hascatalog" = false even though it is available won't show in public.

AzeTech
  • 623
  • 11
  • 21
0

per the documentation here you can only get tracks returned when you are requesting an individual LibraryPlaylist. You will see from the documentation here that artwork is part of the LibrarySong object. So you cannot in one call get all of the artwork for 100 playlists at a time, which is what it appears you are attempting to do.

Two ways around this would be to get the list of playlists and then for each playlist, call the playlist endpoint again, using parameter include=tracks. You will then get back the listing of tracks as part of the response, which will include the artwork.

That may result in too many calls if you are trying to do some sort of mass data scrape. You could also parse each response to your call to playlists and create a map of track ids. Then send a request to library/songs which accepts up to 300 track ids in one call.

The documentation for catalog/playlists states that artwork is a required attribute of the response, but that is not the case for library/playlists. Perhaps that is what was tripping you up.

HTH.

Jermeel
  • 1
  • 1