# musicdl-cli

> A simple cli tool to download your favourite music/album/playlist from Spotify.

Latest version **3.3.0** (published 2025-12-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install musicdl-cli
pnpm add musicdl-cli
yarn add musicdl-cli
bun add musicdl-cli
```

Provides the command `musicdl-cli`.

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 3.3.0 |
| Published | 2025-12-07 |
| First published | 2022-07-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 111.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Abhinav Dhakal |
| Maintainers | abhinavdhakal |

## Links

- npm: https://www.npmjs.com/package/musicdl-cli
- Repository: https://github.com/AbhinavDhakal/musicdl-cli
- Homepage: https://github.com/AbhinavDhakal/musicdl-cli#readme
- Issues: https://github.com/AbhinavDhakal/musicdl-cli/issues
- npm.io page: https://npm.io/package/musicdl-cli

## Dependencies (15)

- [axios](https://npm.io/package/axios.md) ^1.6.0
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [config](https://npm.io/package/config.md) ^3.3.9
- [last-fm](https://npm.io/package/last-fm.md) ^5.3.0
- [play-dl](https://npm.io/package/play-dl.md) ^1.9.7
- [inquirer](https://npm.io/package/inquirer.md) ^8.2.6
- [youtubei.js](https://npm.io/package/youtubei.js.md) ^16.0.1
- [cli-progress](https://npm.io/package/cli-progress.md) ^3.12.0
- [fluent-ffmpeg](https://npm.io/package/fluent-ffmpeg.md) ^2.1.2
- [@yimura/scraper](https://npm.io/package/@yimura/scraper.md) ^1.2.4
- [@distube/ytdl-core](https://npm.io/package/@distube/ytdl-core.md) ^4.16.12
- [browser-id3-writer](https://npm.io/package/browser-id3-writer.md) ^4.4.0
- [filename-converter](https://npm.io/package/filename-converter.md) ^1.0.0
- [spotify-web-api-node](https://npm.io/package/spotify-web-api-node.md) ^5.0.2
- [@ffmpeg-installer/ffmpeg](https://npm.io/package/@ffmpeg-installer/ffmpeg.md) ^1.1.0

## Recent versions

- 3.3.0 (latest) — 2025-12-07
- 3.2.1 — 2025-09-05
- 3.2.0 — 2025-09-05
- 3.1.0 — 2024-01-14
- 3.0.0 — 2023-12-27
- 2.1.0 — 2023-01-30
- 2.0.1 — 2023-01-30
- 2.0.0 — 2023-01-19
- 1.2.0 — 2022-07-23
- 1.1.3 — 2022-07-23
- 1.1.2 — 2022-07-22
- 1.1.1 — 2022-07-22
- 1.0.10 — 2022-07-22
- 1.1.0 — 2022-07-21
- 1.0.9 — 2022-07-14
- … 8 more at https://npm.io/package/musicdl-cli/versions

## README

# musicdl-cli

A simple cli spotify music downloader.

It uses freely available music videos as the audio source and Spotify API for playlist/album/track details.

*As there are plenty of reverbs and remix and lofi edits in youtube, the tool may not get the correct audio sometimes*

## Requirements

- **Node.js** v18+ (uses native fetch internally)
- **yt-dlp** - Required for reliable YouTube downloads
  ```bash
  # macOS (Homebrew)
  brew install yt-dlp

  # Windows/Linux (pip)
  pip install yt-dlp
  ```

## Installation

**Using npm**:

**`
$ sudo npm i musicdl-cli -g
`**

**Using Git**:
```bash
$ git clone https://github.com/AbhinavDhakal/musicdl-cli.git
$ cd musicdl-cli
$ npm install
$ sudo npm link
```


## Configuration
Configuration:

To use this CLI tool, you will need Spotify client id and client secret.
Click [here](#i-dont-have-spotify-client-and-secret
) if you don't have one

After getting Spotify client id and client secret,
Run following command to locate your config file :

```bash
$ musicdl-cli -c
```


![config](./images/config.png?raw=true "Title")

Then edit the config file and update the spotify client and secret.

You can also specify your download location in config file. 



## Usage/Examples


```bash
musicdl-cli [options] <song name or spotify URL>

Options:
  -h, --help     Show this help message
  -c             Show config file location
  -d <number>    Set number of parallel downloads (default: 2)
  -l             Download lyrics (if available)



Search and download **song**: *(one at a time)*
```bash
$ musicdl-cli "lost frank ocean"
```

Download spotify **album**:
```bash
$ musicdl-cli "https://open.spotify.com/album/34GQP3dILpyCN018y2k61L"
```

Download spotify **playlist**:
```bash
$ musicdl-cli "https://open.spotify.com/playlist/any-playlist"
```
Download spotify **track**:
```bash
$ musicdl-cli  "https://open.spotify.com/track/any-track"
```

## Options

Lyrics 

You can also include **synced lyrics** by using `-l` flag:
```bash
$ musicdl-cli -l "joji i'll see you in 40"
```

No. of parallel downloads. Defaul is `2`.
```bash
-d <no of parallel downloads you want>
```
For eg.
```bash
musicdl-cli -l "https://open.spotify.com/album/34GQP3dILpyCN018y2k61L" -d 3
```
The above command will download 3 tracks at a time.

## Debugging

Debug logs are automatically saved to:
- **macOS/Linux**: `~/.config/musicdl-cli/musicdl-cli.log`
- **Windows**: `%APPDATA%/musicdl-cli/musicdl-cli.log`

Check the log file if you encounter any issues with downloads or lyrics.

## Changelog

### v3.3.0
- **Fixed**: YouTube download reliability - now uses `yt-dlp` as primary download method with multiple fallbacks
- **New**: Time-synced lyrics support via multiple APIs (lrclib.net, spotify-lyrics-api)
- **New**: Help command (`-h` or `--help`)
- **Improved**: Better error handling and logging
- **Fixed**: Removed deprecated `request-promise` and `node-fetch` packages
- **Fixed**: Temp file cleanup after encoding

## I don't have spotify client and secret

Sign up for a Spotify developer account [here](https://developer.spotify.com/my-applications/#!/login). If you already have a Spotify account, you'll just have to log in.

Once you're signed up, navigate to https://developer.spotify.com/my-applications/. Follow these steps:

![First Step](./images/1.png?raw=true "Title")
![Second Step](./images/2.png?raw=true "Title")
![Third Step](./images/3.png?raw=true "Title")

There you go, [now add those to the config file](#Configuration). 
## License

[ISC](https://choosealicense.com/licenses/isc/)

---
_Source: https://npm.io/package/musicdl-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
