0.1.2 • Published 6 years ago

ytdl-run-ng v0.1.2

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

ytdl-run

youtube-dl runner in node.js

npm npm

Install

yarn add ytdl-run

Usage

Basic

const ytdl = require('ytdl-run')

// supports async/await
(async _=>{
  // download file into current working directory
  await ytdl('https://www.youtube.com/watch?v=JQGRg8XBnB4')

  console.log('downloaded!')
})()

Info

const info = await ytdl.getInfo('https://www.youtube.com/watch?v=JQGRg8XBnB4')

console.log(info.title) // [MV] MOMOLAND (모모랜드) _ BBoom BBoom (뿜뿜)
console.log(info.duration) // 210

Stream

const fs = require('fs')

ytdl.stream('https://www.youtube.com/watch?v=JQGRg8XBnB4')
  .stdout
  .pipe(fs.createWriteStream('video.mp4'))

Options

const opts = [
  '-o', '%(title)s.%(ext)s',
  '--audio-quality', '0',
  'https://www.youtube.com/watch?v=JQGRg8XBnB4'
]
ytdl(opts)

Related

License

MIT