Package Exports
- @erlc/node-tube-dl
- @erlc/node-tube-dl/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@erlc/node-tube-dl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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)