This is a ruby wrapper for the Apple Music API.
Forked from apple_music gem with the goal of making it more production ready for our own use. But feel-free to use it aswell.
Add this line to your application's Gemfile:
gem 'apple_music'
And then execute:
$ bundle
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 Multiple Catalog Albums by UPC | β | π | |
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 | β | π |
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