@erlc/node-tube-dl
v3.0.0
Published
YouTube Downloader
Downloads
54
Maintainers
Readme
YouTube Downloader
This package continues the version of node-tube-dl
Note
To use this package you must have FFmpeg installed on your computer.
Installing
Npm:
npm install @erlc/node-tube-dl@latest
Yarn:
yarn add @erlc/node-tube-dl@latest
Usage
Download audio:
// TypeScript
// import { YouTubeAudio } from "@erlc/node-tube-dl"
const { YouTubeAudio } = require("@erlc/node-tube-dl");
const url = "https://youtube.com/watch?v=2PK3sE7-C6U";
new YouTubeAudio(url)
// Get available audio codec from: https://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
.codec("flac")
.outputDirectory("path/to/your/folder")
// .fileName("audiooo")
.fileExtension("flac")
.download()
.then(console.log)
.catch(console.log);
Download video:
// TypeScript
// import { YouTubeVideo } from "@erlc/node-tube-dl"
const { YouTubeVideo } = require("@erlc/node-tube-dl");
const url = "https://youtube.com/watch?v=2PK3sE7-C6U";
new YouTubeVideo(url)
// Quality: 144p, 240p, 360p, 480p, 720p, 1080p
.quality("360p")
// Optional. Default uses the title from the video.
// .fileName("videooo")
.outputDirectory("path/to/your/folder")
.download()
.then(console.log)
.catch(console.log);
Search video:
// TypeScript
// import { YouTubeSearch } from "@erlc/node-tube-dl"
const { YouTubeSearch } = require("@erlc/node-tube-dl");
const query = "Axel Johansson";
// get all videos
new YouTubeSearch(query)
.allVideo()
.then(({ videos }) => console.log(videos))
.catch(console.log);
// get specific video
// new YouTubeSearch(query)
// .specificVideo()
// .then(console.log)
// .catch(console.log)