A Python command-line tool to download music from Audiomack using simple HTTP requests. This script authenticates with the Audiomack API and downloads high-quality audio files to your local machine.
- 🎵 Download music from Audiomack
- 🔐 OAuth 1.0 authentication with HMAC-SHA1 signature
- ✅ URL validation to ensure only valid Audiomack URLs are processed
- 📁 Automatic file organization in a
downloadsdirectory - 🎧 High-quality audio downloads (HQ enabled)
- 🚀 Simple command-line interface
- Python 3.6 or higher
- pip (Python package installer)
- Clone this repository:
git clone https://github.com/OkoyaUsman/audiomack.git
cd audiomack- Navigate to the project directory:
cd audiomack- Install the required dependencies:
pip install -r requirements.txtOr install directly:
pip install requestsRun the script with an Audiomack URL as an argument:
python main.py <audiomack_url>python main.py https://audiomack.com/artist/song-nameThe downloaded audio file will be saved in the downloads directory with a filename based on the song path. For example:
- URL:
https://audiomack.com/artist/song-name - Output:
downloads/artist_song-name.m4a(or appropriate extension)
-
URL Validation: The script validates that the provided URL is from
audiomack.comand contains a valid path. -
OAuth Authentication:
- Generates a random nonce for each request
- Creates an OAuth timestamp
- Builds OAuth parameters including consumer key, signature method, and version
- Generates an HMAC-SHA1 signature using the consumer secret
-
API Request:
- Sends an authenticated GET request to the Audiomack API
- Receives a signed URL for the audio file
-
Download:
- Downloads the audio file from the signed URL
- Saves it to the
downloadsdirectory with an appropriate filename and extension
audiomack/
├── main.py # Main script file
├── requirements.txt # Python dependencies
├── README.md # This file
└── downloads/ # Directory where downloaded files are saved (created automatically)
main(): Entry point that handles argument parsing, API authentication, and file downloadaudiomack_url(value: str): Validates that the input URL is a valid Audiomack URLgenerate_nonce(length: int): Generates a random nonce for OAuth authenticationgenerate_signature(params: dict): Creates HMAC-SHA1 OAuth signature from parameters
- OAuth 1.0 Authentication: Implements the OAuth 1.0 protocol with HMAC-SHA1 signature method
- URL Parsing: Uses
urllib.parseto extract and validate URL components - File Handling: Uses
pathlib.Pathfor cross-platform file path management
The script includes validation for:
- Invalid URL schemes (must be http:// or https://)
- Non-Audiomack domains
- Missing URL paths
- Invalid URL format
requests: For making HTTP requests to the Audiomack API
All other dependencies (os, hmac, time, base64, random, string, hashlib, argparse, urllib.parse, pathlib) are part of Python's standard library.
- The script uses a hardcoded consumer secret for OAuth authentication
- Downloads are saved in high quality (HQ) format
- The
downloadsdirectory is created automatically if it doesn't exist - File extensions are automatically detected from the API response
This project is provided as-is for educational purposes. Please respect Audiomack's terms of service and copyright policies when using this tool.
Contributions are welcome! Please feel free to submit a Pull Request.
This tool is for educational purposes only. Users are responsible for ensuring they have the right to download content from Audiomack and must comply with all applicable laws and terms of service.