AppleMusicFeed

Elixir client for the editorial and catalog discovery portions of the Apple Music API.

This package is centered around chart and storefront browsing, plus fetching known Apple Music resources by ID.

Installation

Add to your mix.exs:

defp deps do
  [
    {:apple_music_feed, "~> 0.1.0"}
  ]
end

Configuration

config :apple_music_feed,
  team_id: System.get_env("APPLE_TEAM_ID"),
  key_id: System.get_env("APPLE_MUSIC_FEED_KEY_ID"),
  private_key_path: System.get_env("APPLE_MUSIC_FEED_PRIVATE_KEY_PATH"),
  storefront: "us"

Supported options:

Quick Start

# Charts by storefront
{:ok, charts} = AppleMusicFeed.get_charts(storefront: "us", types: ["songs", "albums"])

# Genres
{:ok, genres} = AppleMusicFeed.get_genres()

# Editorial mixes / stations
{:ok, mixes} = AppleMusicFeed.get_editorial_mixes(limit: 10)

# Recommendations
{:ok, recs} = AppleMusicFeed.get_recommendations(limit: 10)

Fetching Known IDs

Some Apple Music feed-style operations are fetch-by-ID, not list-all endpoints.

AppleMusicFeed.get_featured_playlists(["pl.5ee8333dbe944d9f9f9c49b8de10d6c5"])
AppleMusicFeed.get_new_releases(["310730204"])
AppleMusicFeed.get_top_songs(["900083885"])
AppleMusicFeed.get_playlist("pl.123456789")
AppleMusicFeed.get_playlist_tracks("pl.123456789", limit: 25)

Live Testing

The shared media integration script covers this package too:

cd apple_music_api
source .env && elixir test_media_apis.exs

Notes

License

MIT