Download Apple Music tracks in ALAC (Apple Lossless Audio Codec) format with complete metadata.
This tool is for personal use only. Downloading copyrighted content may violate Apple's Terms of Service and local laws. Use responsibly and only for music you have the right to download.
- ✅ Downloads in ALAC (Apple Lossless) format
- ✅ Preserves full quality audio
- ✅ Embeds complete iTunes metadata (title, artist, album, year, composer, ISRC, UPC, etc.)
- ✅ Downloads album artwork
- ✅ Supports full album downloads
- ✅ Automatic file organization
- ✅ FairPlay DRM decryption via Frida
- Python 3.8 or higher
- Android Studio with Android Emulator
- ADB (Android Debug Bridge)
- Frida and frida-tools
- Active Apple Music subscription
- httpx >= 0.27.0
- m3u8 >= 3.5.0
- construct >= 2.10.68
- frida >= 16.0.0
- frida-tools >= 12.0.0
git clone https://github.com/w3Abhishek/AppleMusicDL.git
cd AppleMusicDLpip install -r requirements.txtOr install in development mode:
pip install -e .-
Create a virtual device in Android Studio
- Use an image without Google APIs (important for Frida compatibility)
- Recommended: Android 10 (API 29) or Android 11 (API 30)
-
Install Apple Music APK
- Download Apple Music 3.6.0 Beta from APKMirror
- Install SAI (Split APKs Installer) on the emulator
- Use SAI to install the Apple Music APK
-
Sign in to Apple Music
- Launch Apple Music on the emulator
- Sign in with your Apple Music account (subscription required)
- Download Frida Server
# Get Frida version
frida --version
# Download matching frida-server for Android
# Visit: https://github.com/frida/frida/releases
# Example for x86_64 emulator:
wget https://github.com/frida/frida/releases/download/16.0.0/frida-server-16.0.0-android-x86_64.xz
unxz frida-server-16.0.0-android-x86_64.xz- Push Frida Server to Emulator
adb root
adb push frida-server-16.0.0-android-x86_64 /data/local/tmp/frida-server
adb shell "chmod 755 /data/local/tmp/frida-server"- Start Frida Server
adb shell "/data/local/tmp/frida-server &"- Verify Frida is Running
frida-ps -UForward the Frida agent port:
adb forward tcp:10020 tcp:10020In a separate terminal, run:
frida -U -l agent.js -f com.apple.android.musicKeep this running while downloading.
python main.py <album_url> [<album_url> ...]Example:
python main.py https://music.apple.com/us/album/whenever-you-need-somebody-2022-remaster/1624945511Multiple albums:
python main.py \
https://music.apple.com/us/album/album1/123456 \
https://music.apple.com/us/album/album2/789012Downloaded files are organized in the AM-DL downloads directory:
AM-DL downloads/
└── Artist Name - Album Name/
├── cover.jpg
├── 01. Track Name.m4a
├── 02. Track Name.m4a
└── ...
AppleMusicDL/
├── apple_music_dl/ # Main package
│ ├── __init__.py # Package initialization
│ ├── api.py # Apple Music API client
│ ├── m3u8_parser.py # M3U8 playlist parser
│ ├── mp4_handler.py # MP4 container handler
│ ├── decryptor.py # Frida-based decryptor
│ ├── metadata.py # MP4 metadata writer
│ ├── models.py # Data models
│ └── utils.py # Utility functions
├── agent.js # Frida agent (JavaScript)
├── main.py # Main entry point
├── requirements.txt # Python dependencies
├── pyproject.toml # Project metadata
└── README.md # Documentation
- API Client (
api.py): Handles authentication and metadata retrieval from Apple Music API - M3U8 Parser (
m3u8_parser.py): Extracts stream URLs and encryption keys from playlists - MP4 Handler (
mp4_handler.py): Parses fragmented MP4 containers and extracts ALAC parameters - Decryptor (
decryptor.py): Communicates with Frida agent via socket for FairPlay decryption - Metadata Writer (
metadata.py): Constructs MP4/M4A files with complete iTunes metadata - Frida Agent (
agent.js): JavaScript agent running on Android for DRM decryption
- Authentication: Extracts bearer token from Apple Music web interface
- Metadata Retrieval: Fetches album and track metadata via API
- Stream Discovery: Parses M3U8 playlists to find ALAC streams
- Download: Downloads encrypted fragmented MP4 files
- Parsing: Extracts ALAC codec parameters and encrypted samples
- Decryption: Sends samples to Frida agent for FairPlay decryption
- Reconstruction: Builds complete M4A file with decrypted audio and metadata
- Ensure Frida server is running on the emulator:
adb shell ps | grep frida - Check port forwarding:
adb forward tcp:10020 tcp:10020 - Verify Frida agent is loaded:
frida -U -l agent.js -f com.apple.android.music
- Some tracks may not be available in lossless format
- Ensure you have an active Apple Music subscription
- Try a different region/storefront
- Check your internet connection
- Apple may have changed their web interface structure
- Try clearing browser cache or use a VPN
- The encryption key list doesn't match the sample count
- Try re-downloading the track
- Check Frida agent logs for errors
python -m pytest tests/This project follows PEP 8 guidelines. Format code with:
black apple_music_dl/
isort apple_music_dl/python -m build- Uses Frida for dynamic instrumentation
Mozilla Public License 2.0 (MPL-2.0)
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Submit a pull request
For issues and questions:
- Open an issue on GitHub
- Provide detailed error messages and logs
- Include your Python version and OS
Remember: This tool is for personal use only. Respect copyright laws and Apple's Terms of Service.