New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

yt-dl-playlist

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yt-dl-playlist

Download audio from YouTube

latest
Source
npmnpm
Version
2.1.0
Version published
Maintainers
1
Created
Source

yt-dl-playlist

ci Coverage Status install size

This module let you to programatic download the audio files of a video playlist on YouTube in MP3 format. It exposes API to download also single audio.

The name of this module is due the npm policy, call it youtube-download-playlist.

⚠ You must use this module/cli respecting the YouTube's Copyright Policies.

Install

Requirements

  • Node.js >= v10
  • ffmpeg installed in your system
npm install yt-dl-playlist

Usage

CLI - Command Line Interface

Run yd --help to see all the options!!

The cli is very simple and quick-and-dirty:

# NPM Global
npm install yt-dl-playlist -g
yd <video_id or playlist_id>

# NPX
npx yt-dl-playlist <video_id or playlist_id> [flags]

Examples:

# Download playlist
yd PLAv2aQ9JgGbVcUtDpuiTB9WgaMljCUpa_ -p

# Download audio
yd 2bexTB7xq_U

# View info video
yd --info 2bexTB7xq_U

FFMPEG

This program needs ffmpeg. It is a free program that elaborate video and audio stream. It can be download also in the portable .zip without installation!

To config the ffmpeg path you can run the script in a cmd shell like this:

yd ZIyyj2FrVI0 -F /ffmpeg/bin

Or more simply run the yd command from the directory where ffmpeg is saved:

cd download/ffmpeg/bin
yd ZIyyj2FrVI0

Module

You can use this lib as a module also!

const DownloadYTFile = require('yt-dl-playlist')

const downloader = new DownloadYTFile({ 
  outputPath: process.cwd(),
  ffmpegPath: './ffmpeg/bin/ffmpeg.exe',
  maxParallelDownload: 10,
  fileNameGenerator: (videoTitle) => {
    return 'a-new-file-name.mp3'
  }
})

downloader.on('video-info', (fileInfo, video) => {
  console.log({ fileInfo, video })
})
downloader.on('video-setting', (fileInfo, settings) => {
  console.log({ fileInfo, settings })
})
downloader.on('start', (fileInfo) => console.log(fileInfo))
downloader.on('progress', (fileInfo) => console.log(fileInfo))
downloader.on('complete', (fileInfo) => console.log(fileInfo))
downloader.on('error', (fileInfo) => console.log(fileInfo.error))

downloader.download(id, inputFileName = null) : Promise<object>
downloader.downloadPlaylist(playlistId) : Promise<Array>

downloader.getPlaylistInfo(playlistId) : Promise<object>
downloader.getVideoInfo(videoId) : Promise<object>

License

Copyright MIT.

Keywords

youtube

FAQs

Package last updated on 09 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts