How to find Explicit Songs on Apple Music User Playlists iOS?
Asked Answered
D

0

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!

Droopy answered 19/3, 2019 at 7:42 Comment(8)
The contentRating Song.Attribute seems to be what you are afterHuddleston
@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: api.music.apple.com/v1/catalog/us/… Search: api.music.apple.com/v1/catalog/us/…Droopy
Wouldn't you need to fetch the relevant tracks from the playlist's relationship to find out if a track is explicit?Huddleston
Sorry @Paulw11, I didn't get you. Can you please elaborate this?Droopy
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.Huddleston
I have updated my question, please have a look and suggest me. Thanks!Droopy
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?Huddleston
Thank you @Huddleston for your suggestion. I have found Bool isExplicitItem in MPMediaItem Class for User Playlists.Droopy

© 2022 - 2024 — McMap. All rights reserved.