youtube-dl driver for node

npm install youtube-dl
4 downloads in the last day
125 downloads in the last week
283 downloads in the last month

youtube-dl Build Status

Download videos from youtube in node.js using youtube-dl.

I also made a pure Javascript youtube downloading module. The reason I'm maintaining this one is because it supports a lot more video sites besides youtube.

If you're only interested in downloading only from youtube, you should consider using the other module.


Downloading videos

var fs = require('fs');
var youtubedl = require('youtube-dl');
var video = youtubedl('',
  // optional arguments passed to youtube-dl

// will be called when the download starts
video.on('info', function(info) {
  console.log('Download started');
  console.log('filename: ' + info.filename);
  console.log('size: ' + info.size);


A similar example can be found in the example folder, and will produce an output that looks like the following when ran.

Got video info
saving to T-ara - Number Nine - MV - 티아라-Seku9G1kT0c.mp4

Getting video information

var youtubedl = require('youtube-dl');
var url = '';
// optional arguments passed to youtube-dl
var options = ['--username=user', '--password=hunter2'];
youtubedl.getInfo(url, options, function(err, info) {
  if (err) throw err;

  console.log('title:', info.title);
  console.log('url:', info.url);
  console.log('thumbnail:', info.thumbnail);
  console.log('description:', info.description);
  console.log('filename:', info.filename);
  console.log('itag:', info.itag);
  console.log('resolution:', info.resolution);

Running that will produce something like

id: WKsjaOqDXgg
title: Ace Rimmer to the Rescue
description: An old Red Dwarf eposide where Ace Rimmer saves the Princess Bonjella.
filename: Ace Rimmer to the Rescue-WKsjaOqDXgg.flv
itag: 34
resolution: 360x640

Getting available formats

var youtubedl = require('youtube-dl');
var url = '';
youtubedl.getFormats(url, function(err, formats) {
  if (err) throw er;

  formats.forEach(function(format) {

Will print something like

{ itag: 34, filetype: 'flv', resolution: '360x640' }
{ itag: 18, filetype: 'mp4', resolution: '360x640' }
{ itag: 43, filetype: 'webm', resolution: '360x640' }
{ itag: 5, filetype: 'flv', resolution: '240x400' }
{ itag: 17, filetype: 'mp4', resolution: '144x176' }

For more usage info on youtube-dl and the arguments you can pass to it, do youtube-dl -h or go to the youtube-dl documentation.


npm install youtube-dl

Use the -g option if you want npm to add a symlink to youtube-dl so it can be used in command line.


Tests are written with vows

npm test



npm loves you