This is a ruby wrapper for the Apple Music API .
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install apple_music
AppleMusic gem was designed with usability as its primary goal:
artist = AppleMusic ::Artist . search ( 'Men I Trust' ) . first # AppleMusic::Artist object
artist . genre_names # ['Electronic']
artist . id # "886240553"
albums = AppleMusic ::Artist . related_albums ( 886240553 ) . map ( &:name ) # ["Oncle Jazz", "Headroom"...
albums = AppleMusic ::Album . search ( 'BILL EVANS' ) # AppleMusic::Album object
tracks = AppleMusic ::Album . related_tracks ( albums [ 0 ] . id )
tracks . first . name # "Waltz for Debby"
songs = AppleMusic ::Song . search ( 'Document' , storefront : :jp ) # AppleMusic::Song object
songs [ 0 ] . artist_name # "TENDRE"
songs [ 0 ] . album_name # "NOT IN ALMIGHTY"
Currently, it work in progress, so it can use apis which does not need user token.
Feature
Status
Docs
Code
Get a Catalog Album
✅
🔗
Get a Catalog Album's Relationship Directly by Name
✅
🔗
Get Multiple Catalog Albums
✅
🔗
Get a Library Album
â›”
🔗
Get a Library Album's Relationship Directly by Name
â›”
🔗
Get Multiple Library Albums
â›”
🔗
Get All Library Albums
â›”
🔗
Feature
Status
Docs
Code
Get a Catalog Artist
✅
🔗
Get Multiple Catalog Artists
✅
🔗
Get a Catalog Artist's Relationship Directly by Name
✅
🔗
Get a Library Artist
â›”
🔗
Get All Library Artists
â›”
🔗
Get Multiple Library Artists
â›”
🔗
Get a Library Artist's Relationship Directly by Name
â›”
🔗
Feature
Status
Docs
Code
Get a Catalog Song
✅
🔗
Get Multiple Catalog Songs by ID
✅
🔗
Get Multiple Catalog Songs by ISRC
✅
🔗
Get a Catalog Song's Relationship Directly by Name
✅
🔗
Get a Library Song
â›”
🔗
Get All Library Songs
â›”
🔗
Get Multiple Library Songs
â›”
🔗
Get a Library Song's Relationship Directly by Name
â›”
🔗
Feature
Status
Docs
Code
Get a Catalog Music Video
✅
🔗
Get a Catalog Music Video's Relationship Directly by Name
✅
🔗
Get Multiple Catalog Music Videos by ID
✅
🔗
Get Multiple Catalog Music Videos by ISRC
✅
🔗
Get a Library Music Video
â›”
🔗
Get a Library Music Video's Relationship Directly by Name
â›”
🔗
Get Multiple Library Music Videos
â›”
🔗
Get All Library Music Videos
â›”
🔗
Feature
Status
Docs
Code
Get a Catalog Playlist
✅
🔗
Get a Catalog Playlist's Relationship Directly by Name
✅
🔗
Get Multiple Catalog Playlists
✅
🔗
Get a Library Playlist
â›”
🔗
Get a Library Playlist's Relationship Directly by Name
â›”
🔗
Get Multiple Library Playlists
â›”
🔗
Get All Library Playlists
â›”
🔗
Feature
Status
Docs
Code
Get a Catalog Station
✅
🔗
Get Multiple Catalog Stations
✅
🔗
Feature
Status
Docs
Code
Search for Catalog Resources
✅
🔗
Get Catalog Search Hints
✅
🔗
Search for Library Resources
â›”
🔗
Feature
Status
Docs
Code
Get a Personal Album Rating
â›”
🔗
Get a Personal Music Video Rating
â›”
🔗
Get a Personal Playlist Rating
â›”
🔗
Get a Personal Song Rating
â›”
🔗
Get a Personal Station Rating
â›”
🔗
Get Multiple Personal Album Ratings
â›”
🔗
Get Multiple Personal Music Video Ratings
â›”
🔗
Get Multiple Personal Playlist Ratings
â›”
🔗
Get Multiple Personal Song Ratings
â›”
🔗
Get Multiple Personal Station Ratings
â›”
🔗
Add a Personal Album Rating
â›”
🔗
Add a Personal Music Video Rating
â›”
🔗
Add a Personal Playlist Rating
â›”
🔗
Add a Personal Song Rating
â›”
🔗
Add a Personal Station Rating
â›”
🔗
Delete a Personal Album Rating
â›”
🔗
Delete a Personal Music Video Rating
â›”
🔗
Delete a Personal Playlist Rating
â›”
🔗
Delete a Personal Song Rating
â›”
🔗
Delete a Personal Station Rating
â›”
🔗
Get a Personal Library Music Video Rating
â›”
🔗
Get a Personal Library Playlist Rating
â›”
🔗
Get a Personal Library Song Rating
â›”
🔗
Get Multiple Personal Library Music Video Ratings
â›”
🔗
Get Multiple Personal Library Playlist Ratings
â›”
🔗
Get Multiple Personal Library Songs Ratings
â›”
🔗
Add a Personal Library Music Video Rating
â›”
🔗
Add a Personal Library Playlist Rating
â›”
🔗
Add a Personal Library Song Rating
â›”
🔗
Delete a Personal Library Music Video Rating
â›”
🔗
Delete a Personal Library Playlist Rating
â›”
🔗
Delete a Personal Library Song Rating
â›”
🔗
Feature
Status
Docs
Code
Get Catalog Charts
✅
🔗
Feature
Status
Docs
Code
Get a Catalog Genre
✅
🔗
Get a Catalog Genre's Relationship Directly by Name
✅
🔗
Get Multiple Catalog Genres
✅
🔗
Get Catalog Top Charts Genres
✅
🔗
Feature
Status
Docs
Code
Get a Catalog Curator
✅
🔗
Get a Catalog Curator's Relationship Directly by Name
✅
🔗
Get Multiple Catalog Curators
✅
🔗
Get a Catalog Apple Curator
â›”
🔗
Get a Catalog Apple Curator's Relationship Directly by Name
â›”
🔗
Get Multiple Catalog Apple Curators
â›”
🔗
Feature
Status
Docs
Code
Get a Recommendation
â›”
🔗
Get Multiple Recommendations
â›”
🔗
Get Default Recommendations
â›”
🔗
Feature
Status
Docs
Code
Get a Catalog Activity
✅
🔗
Get a Catalog Activity's Relationship Directly by Name
✅
🔗
Get Multiple Catalog Activities
✅
🔗
Feature
Status
Docs
Code
Get Heavy Rotation Content
â›”
🔗
Get Recently Played Resources
â›”
🔗
Get Recently Played Stations
â›”
🔗
Get Recently Added Resources
â›”
🔗
Storefronts and Localization
Feature
Status
Docs
Code
Get a User's Storefront
✅
🔗
Get a Storefront
✅
🔗
Get Multiple Storefronts
✅
🔗
Get All Storefronts
✅
🔗
NOTE It's necessary to prepare an TEAM_ID
, MUSIC_ID
, and a secret file in advance. Please confirm Apple Developer Website .
It can be set by either an ENV
variable or an config/initializers/apple_music.rb
:
AppleMusic . configure do |config |
config . secret_key_path = './AuthKey_MUSIC_ID.p8' # or ENV['APPLE_MUSIC_SECRET_KEY_PATH']
config . team_id = 'YOUR TEAM_ID' # or ENV['APPLE_MUSIC_TEAM_ID']
config . music_id = 'YOUR MUSIC_ID' # or ENV['APPLE_MUSIC_MUSIC_ID']
config . storefront = 'jp' # or ENV['APPLE_MUSIC_STOREFRONT'] ('us' by default)
end
MIT