0

I am fetching all Apple Music Playlists and Track lists into my App using AppleMusicAPI (Refers https://developer.apple.com/documentation/applemusicapi). Also In my App's Setting screen I have added a UISwitch to allow Explicit contents of Apple Music.

I can able to get Explicit songs in below Search API and Top Tracks API using attributes.contentRating JSON key.

Top Charts API: https://api.music.apple.com/v1/catalog/us/charts?limit=20&offset=0&types=songs

Search API: https://api.music.apple.com/v1/catalog/us/search?limit=20&offset=0&term=Ana&types=songs

Can anyone suggest me how can I get to know wether the song is Explicit or not for UserPlaylist songs? Thank you!

Anand Gautam
  • 2,541
  • 3
  • 34
  • 70
  • The `contentRating` [Song.Attribute](https://developer.apple.com/documentation/applemusicapi/song/attributes) seems to be what you are after – Paulw11 Mar 19 '19 at 08:55
  • @Paulw11I can able to get contentRating from Top Tracks and Search Tracks API, but it's missing in UserPlaylists API. Here is the API details for both : Top Charts: https://api.music.apple.com/v1/catalog/us/charts?limit=20&offset=0&types=songs Search: https://api.music.apple.com/v1/catalog/us/search?limit=20&offset=0&term=Ana&types=songs – Anand Gautam Mar 19 '19 at 09:35
  • Wouldn't you need to fetch the relevant tracks from the playlist's relationship to find out if a track is explicit? – Paulw11 Mar 19 '19 at 09:39
  • Sorry @Paulw11, I didn't get you. Can you please elaborate this? – Anand Gautam Mar 19 '19 at 09:53
  • Perhaps you could add some more detail to your question. As I understand it you say that the explicit attribute isn't included in the playlist data. A playlist contains tracks. You would need to retrieve the track to find out if it is explicit. – Paulw11 Mar 19 '19 at 09:56
  • I have updated my question, please have a look and suggest me. Thanks! – Anand Gautam Mar 19 '19 at 10:10
  • What query are you executing to get the playlist? What results do you get back - Can you show the request and a snippet of the returned JSON? – Paulw11 Mar 19 '19 at 10:12
  • Thank you @Paulw11 for your suggestion. I have found Bool isExplicitItem in MPMediaItem Class for User Playlists. – Anand Gautam Mar 19 '19 at 12:10

0 Answers0