# youtube-to

> Converts youtube links to audio/video formats.

Latest version **1.1.4** (published 2018-05-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install youtube-to
pnpm add youtube-to
yarn add youtube-to
bun add youtube-to
```

Provides the command `youto`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2018-05-01 |
| First published | 2017-09-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 37 |
| Author | kivancguckiran |
| Maintainers | kivancguckiran |
| Keywords | youtube, mp3, flv |

## Links

- npm: https://www.npmjs.com/package/youtube-to
- Repository: https://github.com/kivancguckiran/youtube-to
- Homepage: https://github.com/kivancguckiran/youtube-to#readme
- Issues: https://github.com/kivancguckiran/youtube-to/issues
- npm.io page: https://npm.io/package/youtube-to

## Dependencies (7)

- [debug](https://npm.io/package/debug.md) ^3.1.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [ytdl-core](https://npm.io/package/ytdl-core.md) ^0.20.2
- [fluent-ffmpeg](https://npm.io/package/fluent-ffmpeg.md) ^2.1.2
- [file-extension](https://npm.io/package/file-extension.md) ^3.1.2
- [ffmpeg-binaries](https://npm.io/package/ffmpeg-binaries.md) ^3.2.2-3
- [sanitize-filename](https://npm.io/package/sanitize-filename.md) ^1.6.1

## Recent versions

- 1.1.4 (latest) — 2018-05-01
- 1.1.3 — 2017-10-16
- 1.1.2 — 2017-10-05
- 1.1.1 — 2017-10-05
- 1.1.0 — 2017-10-05
- 1.0.1 — 2017-09-19
- 1.0.0 — 2017-09-19

## README

# youtube-to
Converts youtube links to audio/video formats using ffmpeg and ytdl libraries. Downloads `ffmpeg` with npm install, no need to specify path. Returns a promise.

```
npm install youtube-to
```

# Usage

```js
const youto = require('youtube-to');

youto('https://www.youtube.com/watch?v=jNQXAC9IVRw')
    .then(() => console.log('Done!'))
    .catch((err) => console.log(err));
```

# API
### youto(url[, options])

Downloads the specified `url` with the `options` provided.

#### options

JSON structure with the options below:

```js
{stream: fs.createWriteStream('file'), filename: 'folder/test.mp3', format: 'mp3'}
```

# Examples

### To mp3
```js
const youto = require('youtube-to');

youto('https://www.youtube.com/watch?v=jNQXAC9IVRw');
```

Converts the video to mp3, gets the title of the video and saves it as `[TITLE].mp3`.

### To FLV
```js
const youto = require('youtube-to');

youto('https://www.youtube.com/watch?v=jNQXAC9IVRw', {format: 'flv'});
```

### Provide a writable stream
```js
const youto = require('youtube-to');

youto('https://www.youtube.com/watch?v=jNQXAC9IVRw', {stream: fs.createWriteStream('zoo.flv'), format: 'flv'});
```

It is required to specify format if it is not mp3.

### Without stream
```js
const youto = require('youtube-to');

youto('https://www.youtube.com/watch?v=jNQXAC9IVRw', {filename: 'folder/zoo.flv'});
```

Format is derived from filename.

# Global installation

```
npm install youtube-to -g
```

### Example

```
> youto

Usage:
        youto [INPUT URL]
        youto "https://www.youtube.com/watch?v=sdL7bE6b6AM"
        youto [INPUT URL] [OUTPUT FILE]
        youto "https://www.youtube.com/watch?v=sdL7bE6b6AM" "Songs/Sweet Baby James.mp3"
        youto [INPUT URL] [OUTPUT FILE] [FORMAT]
        youto "https://www.youtube.com/watch?v=sdL7bE6b6AM" "Sweet Baby James" "flv"

```


```
> youto 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
```

Gets video's title and converts to mp3 as `[TITLE].mp3`.

```
> youto 'https://www.youtube.com/watch?v=jNQXAC9IVRw' 'video/zoo.ogg'
```

Saves the video to `video/zoo.ogg` with `ogg` type.

```
> youto 'https://www.youtube.com/watch?v=jNQXAC9IVRw' 'video/zoo' 'flv'
```

Converts the video to `flv` and saves it to `video/zoo`

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