# yt-get

> A library for downloading mp3 data from youtube videos and playlists

Latest version **1.1.2** (published 2023-05-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install yt-get
pnpm add yt-get
yarn add yt-get
bun add yt-get
```

## Health

**Score 25/100 (F)** — status: abandoned.

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2023-05-30 |
| First published | 2023-05-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Agustin Wet |
| Maintainers | tin54321 |
| Keywords | youtube, downloader, playlist, video, mp3, library |

## Links

- npm: https://www.npmjs.com/package/yt-get
- Repository: https://github.com/wet333/yt-get
- Homepage: https://github.com/wet333/yt-get#readme
- Issues: https://github.com/wet333/yt-get/issues
- npm.io page: https://npm.io/package/yt-get

## Dependencies (2)

- [ytpl](https://npm.io/package/ytpl.md) ^2.3.0
- [ytdl-core](https://npm.io/package/ytdl-core.md) ^4.11.4

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2023-05-30
- 1.1.1 — 2023-05-30
- 1.1.0 — 2023-05-30
- 1.0.8 — 2023-05-29
- 1.0.7 — 2023-05-29
- 1.0.6 — 2023-05-29
- 1.0.5 — 2023-05-29

## README

# yt-get

A concise library for downloading MP3 data from YouTube videos and playlists.

---

## Instalation
To use this function, you need to have Node.js installed on your machine. You also need to install the `yt-get` library. You can install it by running the following command in your terminal:
```shell
npm install yt-get
```

---

## API

### .getVideoTitle(videoURL)
This function takes a 'videoURL' as input and returns the title of the YouTube video as a sanitized filename.
##### Parameters
- videoURL (string): The URL of the YouTube video.
##### Returns
- A Promise that resolves to the video title as a sanitized filename.
#### Example
```node
const videoURL = "https://www.youtube.com/watch?v=VIDEO_ID";

getVideoTitle(videoURL)
    .then((videoTitle) => {
        console.log("Video Title:", videoTitle);
    })
    .catch((error) => {
        console.error("Error:", error);
    });
```

### .getVideoMP3Base64(videoURL)
This function takes a videoURL as input and returns a Promise that resolves to an object containing the base64-encoded MP3 audio and the title of the YouTube video.
##### Parameters
- videoURL (string): The URL of the YouTube video.
##### Returns
- A Promise that resolves to the video title as a sanitized filename.
    - base64 (string): The base64-encoded MP3 audio.
    - title (string): The title of the YouTube video.
#### Example
```node
const videoURL = "https://www.youtube.com/watch?v=VIDEO_ID";

getVideoMP3Base64(videoURL)
    .then((result) => {
        const { base64, title } = result;
        console.log("Video Title:", title);
        console.log("Base64-encoded MP3:", base64);
    })
    .catch((error) => {
        console.error("Error:", error);
    });
```

### .getVideoMP3Binary(videoURL)
This function takes a videoURL as input and returns a Promise that resolves to an object containing the binary data of the MP3 audio and the title of the YouTube video.
##### Parameters
- videoURL (string): The URL of the YouTube video.
##### Returns
- A Promise that resolves to the video title as a sanitized filename.
    - mp3 (Buffer): The binary data of the MP3 audio.
    - title (string): The title of the YouTube video.
#### Example
```node
const videoURL = "https://www.youtube.com/watch?v=VIDEO_ID";

getVideoMP3Binary(videoURL)
    .then((result) => {
        const { mp3, title } = result;
        console.log("Video Title:", title);
        // Use the `mp3` Buffer as needed.
    })
    .catch((error) => {
        console.error("Error:", error);
    });
```

### .downloadPlaylist(playlistURL)
This function takes a playlistURL as input and downloads all the videos from the YouTube playlist.
##### Parameters
- playlistURL (string): The URL of the YouTube playlist.
##### Returns
- (void): the function dowload the files into a folder in the directory where its called.
#### Example
```node
const playlistURL = "https://www.youtube.com/playlist?list=PLAYLIST_ID";

downloadPlaylist(playlistURL)
    .then(() => {
        console.log("Playlist downloaded successfully.");
    })
    .catch((error) => {
        console.error("Error:", error);
    });
```

### .downloadVideo(videoURL)
This function takes a videoURL as input and downloads the audio data from the Youtube video.
##### Parameters
- playlistURL (string): The URL of the YouTube playlist.
##### Returns
- (void): the function download the file into a folder in the directory where its called.
#### Example
```node
const videoURL = "https://www.youtube.com/watch?v=VIDEO_ID";

downloadVideo(videoURL)
    .then(() => {
        console.log("Video downloaded successfully.");
    })
    .catch((error) => {
        console.error("Error:", error);
    });
```

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