AppleMusic
This is a ruby wrapper for the Apple Music API.
Installation
Add this line to your application's Gemfile:
gem 'apple_music'
And then execute:
$ bundle
Or install it yourself as:
$ gem install apple_music
Usage
AppleMusic gem was designed with usability as its primary goal:
e.g. Search Artists
artist = AppleMusic::Artist.search('Men I Trust').first
artist.genre_names
artist.id
albums = AppleMusic::Artist.related_albums(886240553).map(&:name)
e.g. Search Albums
albums = AppleMusic::Album.search('BILL EVANS')
tracks = AppleMusic::Album.related_tracks(albums[0].id)
tracks.first.name
e.g. Search Songs
songs = AppleMusic::Song.search('Document', storefront: :jp)
songs[0].artist_name
songs[0].album_name
Features
Currently, it work in progress, so it can use apis which does not need user token.
Albums
Feature | Status | Docs | Code |
---|
Get a Catalog Album | :white_check_mark: | :link: | :octocat: |
Get a Catalog Album's Relationship Directly by Name | :white_check_mark: | :link: | :octocat: |
Get Multiple Catalog Albums | :white_check_mark: | :link: | :octocat: |
Get Multiple Catalog Albums by UPC | :white_check_mark: | :link: | :octocat: |
Get a Library Album | :no_entry: | :link: | |
Get a Library Album's Relationship Directly by Name | :no_entry: | :link: | |
Get Multiple Library Albums | :no_entry: | :link: | |
Get All Library Albums | :no_entry: | :link: | |
Artists
Feature | Status | Docs | Code |
---|
Get a Catalog Artist | :white_check_mark: | :link: | :octocat: |
Get Multiple Catalog Artists | :white_check_mark: | :link: | :octocat: |
Get a Catalog Artist's Relationship Directly by Name | :white_check_mark: | :link: | :octocat: |
Get a Library Artist | :no_entry: | :link: | |
Get All Library Artists | :no_entry: | :link: | |
Get Multiple Library Artists | :no_entry: | :link: | |
Get a Library Artist's Relationship Directly by Name | :no_entry: | :link: | |
Songs
Feature | Status | Docs | Code |
---|
Get a Catalog Song | :white_check_mark: | :link: | :octocat: |
Get Multiple Catalog Songs by ID | :white_check_mark: | :link: | :octocat: |
Get Multiple Catalog Songs by ISRC | :white_check_mark: | :link: | :octocat: |
Get a Catalog Song's Relationship Directly by Name | :white_check_mark: | :link: | :octocat: |
Get a Library Song | :no_entry: | :link: | |
Get All Library Songs | :no_entry: | :link: | |
Get Multiple Library Songs | :no_entry: | :link: | |
Get a Library Song's Relationship Directly by Name | :no_entry: | :link: | |
Music Videos
Feature | Status | Docs | Code |
---|
Get a Catalog Music Video | :white_check_mark: | :link: | :octocat: |
Get a Catalog Music Video's Relationship Directly by Name | :white_check_mark: | :link: | :octocat: |
Get Multiple Catalog Music Videos by ID | :white_check_mark: | :link: | :octocat: |
Get Multiple Catalog Music Videos by ISRC | :white_check_mark: | :link: | :octocat: |
Get a Library Music Video | :no_entry: | :link: | |
Get a Library Music Video's Relationship Directly by Name | :no_entry: | :link: | |
Get Multiple Library Music Videos | :no_entry: | :link: | |
Get All Library Music Videos | :no_entry: | :link: | |
Playlists
Feature | Status | Docs | Code |
---|
Get a Catalog Playlist | :white_check_mark: | :link: | :octocat: |
Get a Catalog Playlist's Relationship Directly by Name | :white_check_mark: | :link: | :octocat: |
Get Multiple Catalog Playlists | :white_check_mark: | :link: | :octocat: |
Get a Library Playlist | :no_entry: | :link: | |
Get a Library Playlist's Relationship Directly by Name | :no_entry: | :link: | |
Get Multiple Library Playlists | :no_entry: | :link: | |
Get All Library Playlists | :no_entry: | :link: | |
Apple Music Stations
Search
Feature | Status | Docs | Code |
---|
Search for Catalog Resources | :white_check_mark: | :link: | :octocat: |
Get Catalog Search Hints | :white_check_mark: | :link: | :octocat: |
Search for Library Resources | :no_entry: | :link: | |
Ratings
Feature | Status | Docs | Code |
---|
Get a Personal Album Rating | :no_entry: | :link: | |
Get a Personal Music Video Rating | :no_entry: | :link: | |
Get a Personal Playlist Rating | :no_entry: | :link: | |
Get a Personal Song Rating | :no_entry: | :link: | |
Get a Personal Station Rating | :no_entry: | :link: | |
Get Multiple Personal Album Ratings | :no_entry: | :link: | |
Get Multiple Personal Music Video Ratings | :no_entry: | :link: | |
Get Multiple Personal Playlist Ratings | :no_entry: | :link: | |
Get Multiple Personal Song Ratings | :no_entry: | :link: | |
Get Multiple Personal Station Ratings | :no_entry: | :link: | |
Add a Personal Album Rating | :no_entry: | :link: | |
Add a Personal Music Video Rating | :no_entry: | :link: | |
Add a Personal Playlist Rating | :no_entry: | :link: | |
Add a Personal Song Rating | :no_entry: | :link: | |
Add a Personal Station Rating | :no_entry: | :link: | |
Delete a Personal Album Rating | :no_entry: | :link: | |
Delete a Personal Music Video Rating | :no_entry: | :link: | |
Delete a Personal Playlist Rating | :no_entry: | :link: | |
Delete a Personal Song Rating | :no_entry: | :link: | |
Delete a Personal Station Rating | :no_entry: | :link: | |
Get a Personal Library Music Video Rating | :no_entry: | :link: | |
Get a Personal Library Playlist Rating | :no_entry: | :link: | |
Get a Personal Library Song Rating | :no_entry: | :link: | |
Get Multiple Personal Library Music Video Ratings | :no_entry: | :link: | |
Get Multiple Personal Library Playlist Ratings | :no_entry: | :link: | |
Get Multiple Personal Library Songs Ratings | :no_entry: | :link: | |
Add a Personal Library Music Video Rating | :no_entry: | :link: | |
Add a Personal Library Playlist Rating | :no_entry: | :link: | |
Add a Personal Library Song Rating | :no_entry: | :link: | |
Delete a Personal Library Music Video Rating | :no_entry: | :link: | |
Delete a Personal Library Playlist Rating | :no_entry: | :link: | |
Delete a Personal Library Song Rating | :no_entry: | :link: | |
Charts
Music Genres
Curators
Feature | Status | Docs | Code |
---|
Get a Catalog Curator | :white_check_mark: | :link: | :octocat: |
Get a Catalog Curator's Relationship Directly by Name | :white_check_mark: | :link: | :octocat: |
Get Multiple Catalog Curators | :white_check_mark: | :link: | :octocat: |
Get a Catalog Apple Curator | :no_entry: | :link: | |
Get a Catalog Apple Curator's Relationship Directly by Name | :no_entry: | :link: | |
Get Multiple Catalog Apple Curators | :no_entry: | :link: | |
Recommendations
Feature | Status | Docs | Code |
---|
Get a Recommendation | :no_entry: | :link: | |
Get Multiple Recommendations | :no_entry: | :link: | |
Get Default Recommendations | :no_entry: | :link: | |
Activities
Feature | Status | Docs | Code |
---|
Get a Catalog Activity | :white_check_mark: | :link: | :octocat: |
Get a Catalog Activity's Relationship Directly by Name | :white_check_mark: | :link: | :octocat: |
Get Multiple Catalog Activities | :white_check_mark: | :link: | :octocat: |
History
Feature | Status | Docs | Code |
---|
Get Heavy Rotation Content | :no_entry: | :link: | |
Get Recently Played Resources | :no_entry: | :link: | |
Get Recently Played Stations | :no_entry: | :link: | |
Get Recently Added Resources | :no_entry: | :link: | |
Storefronts and Localization
Configuration
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'
config.team_id = 'YOUR TEAM_ID'
config.music_id = 'YOUR MUSIC_ID'
config.storefront = 'jp'
end
License
MIT