# ytdl-mp3

> An NPM package to facilitate downloading music from YouTube, including automatic retrieval of ID3 tags and album art via the iTunes public API.

Latest version **5.2.2** (published 2025-03-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install ytdl-mp3
pnpm add ytdl-mp3
yarn add ytdl-mp3
bun add ytdl-mp3
```

Provides the command `ytdl-mp3`.

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.2.2 |
| Published | 2025-03-01 |
| First published | 2022-02-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.0.0 |
| Dependencies | 5 |
| Unpacked size | 58.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 30 |
| Author | Joshua Unrau |
| Maintainers | joshunrau |
| Keywords | youtube, download, mp3, music |

## Links

- npm: https://www.npmjs.com/package/ytdl-mp3
- Repository: https://github.com/joshunrau/ytdl-mp3
- Homepage: https://github.com/joshunrau/ytdl-mp3#readme
- Issues: https://github.com/joshunrau/ytdl-mp3/issues
- npm.io page: https://npm.io/package/ytdl-mp3

## Dependencies (5)

- [axios](https://npm.io/package/axios.md) ^1.8.1
- [node-id3](https://npm.io/package/node-id3.md) 0.2.5
- [commander](https://npm.io/package/commander.md) ^13.1.0
- [ffmpeg-static](https://npm.io/package/ffmpeg-static.md) ^5.2.0
- [@distube/ytdl-core](https://npm.io/package/@distube/ytdl-core.md) ^4.16.4

## Recent versions

- 5.2.2 (latest) — 2025-03-01
- 5.2.1 — 2025-02-07
- 5.2.0 — 2024-12-19
- 5.1.0 — 2024-12-16
- 5.0.0 — 2024-08-25
- 5.0.0-beta.1 — 2024-08-25
- 4.0.2 — 2024-08-25
- 4.0.1 — 2024-07-29
- 4.0.0 — 2024-06-19
- 3.4.1 — 2023-09-15
- 3.4.0 — 2023-09-06
- 3.3.0 — 2023-09-05
- 3.2.0 — 2023-09-05
- 3.1.3 — 2023-09-05
- 3.1.2 — 2023-09-05
- … 16 more at https://npm.io/package/ytdl-mp3/versions

## README

<!-- PROJECT LOGO -->
<div align="center">
  <h3 align="center">ytdl-mp3</h3>
  <p align="center">
    An NPM package to facilitate downloading music from YouTube, including automatic retrieval of ID3 tags and album art via the iTunes public API.
    <br />
    <a href="https://github.com/joshunrau/ytdl-mp3/issues" rel="noreferrer" target="_blank">Report Bug</a>
    ·
    <a href="https://github.com/joshunrau/ytdl-mp3/issues" rel="noreferrer" target="_blank">Request Feature</a>
  </p>
</div>

<!-- PROJECT SHIELDS -->
<div align="center">

![license](https://img.shields.io/github/license/joshunrau/ytdl-mp3)
![version](https://img.shields.io/github/package-json/v/joshunrau/ytdl-mp3)
[![codecov](https://codecov.io/gh/joshunrau/ytdl-mp3/graph/badge.svg?token=T35BBZ7Q42)](https://codecov.io/gh/joshunrau/ytdl-mp3)

</div>
<hr />

## Installation

```shell
npm install -g ytdl-mp3
```

## Usage

### Command-Line

The easiest way to use ytdl-mp3 is through the command-line interface. Users must enter the URL of the YouTube video they wish to download. The title of the music video is then used to automatically retrieve ID3 tags (e.g., title, artist) and the associated cover art from iTunes. There is no need for the title of the YouTube video to follow a specific naming convention.

```
Usage: ytdl-mp3 [options] <url>

A NodeJS package and command-line tool for downloading music from YouTube, including automatic retrieval of ID3 tags and album art via iTunes.

Arguments:
url                     url of video to download

Options:
-V, --version           output the version number
-o --output-dir <path>  path to output directory
-n --no-get-tags        skip extracting/applying id3 tags
-v --verify-tags        verify id3 tags fetched from itunes
-s --silent-mode        skip console output
-h, --help              display help for command
```

### ESM

```javascript
import { Downloader } from 'ytdl-mp3';

const downloader = new Downloader({
  getTags: true
});

await downloader.downloadSong('https://www.youtube.com/watch?v=7jgnv0xCv-k');
```

### CommonJS

```javascript
const { Downloader } = require('ytdl-mp3');

async function main() {
  const downloader = new Downloader({
    getTags: true
  });
  await downloader.downloadSong('https://www.youtube.com/watch?v=7jgnv0xCv-k');
}

main();
```

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