Skip to content

lbr77/apple-music-api

Repository files navigation

apple-music-api

Apple Music daemon for x86_64-linux-android.

This project boots an Android Apple Music runtime, exposes a small HTTP service, and supports local playback decryption plus a Subsonic-compatible interface. API details, request parameters, and response examples live in API.md.

Tip

Full lyrics require MEDIA_USER_TOKEN. In this daemon, provide it with --media-user-token or WRAPPER_MEDIA_USER_TOKEN.

Warning

Using Apple Music in an unofficial or non-standard environment to download songs may trigger account enforcement, including suspension or termination.

Important

This project is provided for research and personal interoperability purposes only. You assume all responsibility for compliance with Apple Music terms, local law, and any account or data risk that follows from using it.

Deployment

Runtime requirements

  • Android Apple Music runtime libraries
  • persistent app data at /data/data/com.apple.android.music
  • ffmpeg and ffprobe at /usr/local/bin
  • required startup flag: --api-token

The default runtime base directory is /data/data/com.apple.android.music/files. Persisting the parent directory is enough for login state and runtime data.

Docker

The repository includes a multi-stage Dockerfile and CI publishes:

ghcr.io/lbr77/apple-music-api:latest

Example:

docker run --rm -p 8080:8080 \
  -v ./persist/com.apple.android.music:/data/data/com.apple.android.music \
  ghcr.io/lbr77/apple-music-api:latest \
  --host 0.0.0.0 \
  --daemon-port 8080 \
  --api-token local-dev-token

Subsonic clients use /rest/* with Subsonic credentials from SUBSONIC_USERNAME and SUBSONIC_PASSWORD. That surface accepts standard Subsonic query auth and does not use the daemon Bearer token.

The daemon also serves a minimal web UI at /app/. The UI has two screens:

  • a Bearer token page
  • a settings page for Apple Music login, 2FA, and logout

Local build

The workspace targets x86_64-linux-android by default.

rustup target add x86_64-linux-android
cargo install --locked cargo-ndk

export ANDROID_NDK_HOME=/path/to/android-ndk
cargo ndk -t x86_64 build --release --bin main

Output:

target/x86_64-linux-android/release/main

Frontend bundle

The frontend lives in frontend/ and is bundled into the daemon binary from frontend/dist.

cd frontend
npm install
npm run build

Use API.md for login flow, route list, request examples, Subsonic usage, and cache behavior.

About

ALAC music download & decrypt

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors