# nishi-yt

**nishi-yt** is a lightweight Node.js API for downloading YouTube media. It supports both video and audio downloads and is not an official tool from en.loader.to.

## Features

- **Simple Integration:** Easily download YouTube content by providing a URL.
- **Multiple Formats:** Choose your desired format (e.g., mp3, mp4). See [./lib/config.js](./lib/config.js) for available formats.
- **Logging Support:** Enable logs to monitor the download process.
- **Duplicate Prevention:** Optionally save URL IDs to prevent duplicate downloads.

## Installation

Install the package via npm or yarn:

```bash
npm i nishi-yt --save
```

```bash
yarn add nishi-yt
```

## ✍️ Usage

```js
const yt = require("nishi-yt")
```

## ⚡ yt.download

```js
// Details, check in files test.js
const yt = require("nishi-yt")

// 📂 Download Media
yt.download({
  yt_link: "https://music.youtube.com/watch?v=m8Zqd58XuoA&list=OLAK5uy_n0t6KymP-tb3EUjViyWXXA4cT1raHJEl8", // Enter the YouTube video url here
  yt_format: "mp3", // Choose several formats to download, you can see it in the script configuration ./lib/config.js
  logs: true, // Just for check running (default: false)
  saveId: true // saves url to load in case anyone downloads with same url id (default: false)
}).then(results => {
  console.log(results)
})
```

Results, This data appears after the download is complete.

```js
// Results data in time 18/04/2023 (Asia/Jakarta)

{
  info: {
    title: 'Kawaii Aesthetic',
    id: 'm8Zqd58XuoA',
  },
  media: 'https://marilyn7.oceansaver.in/pacific/?k7Ck2foXI1QgGl9rQ37bjBE9HXQ'
}
```