{"_id":"@brainsights/youtube-dl","_rev":"3-1a5a9b6e69a0b0b0f125a6b9625aa903","name":"@brainsights/youtube-dl","dist-tags":{"latest":"1.12.4"},"versions":{"1.12.3":{"name":"@brainsights/youtube-dl","description":"youtube-dl driver for node","keywords":["youtube","video","download"],"version":"1.12.3","repository":{"type":"git","url":"git://github.com/przemyslawpluta/node-youtube-dl.git"},"author":{"name":"Roly Fentanes","url":"https://github.com/fent"},"contributors":[{"name":"Przemyslaw Pluta","email":"przemyslawplutadev@gmail.com","url":"http://przemyslawpluta.com"},{"name":"Andrew Carlson","email":"andrew@stem.is"}],"main":"./lib/youtube-dl.js","directories":{"lib":"./lib"},"scripts":{"postinstall":"node ./scripts/download.js","update":"node ./scripts/download.js","test":"vows ./test/*.js --spec"},"dependencies":{"hh-mm-ss":"^1.2.0","mkdirp":"^0.5.1","request":"^2.83.0","streamify":"^0.2.9"},"devDependencies":{"vows":"*"},"license":"MIT","gitHead":"88828cff490c81bc810a0b94acf8a5336e4e9af1","bugs":{"url":"https://github.com/przemyslawpluta/node-youtube-dl/issues"},"homepage":"https://github.com/przemyslawpluta/node-youtube-dl#readme","_id":"@brainsights/youtube-dl@1.12.3","_npmVersion":"5.6.0","_nodeVersion":"8.9.3","_npmUser":{"name":"modeswitch","email":"npm@ack.modeswitch.org"},"dist":{"integrity":"sha512-ag7/PSGhvI/ri5K4rpCs0wUHqNRaOiJQDQ1okBXqE5tW7n/YAJSol3oUDu5mAakCRrj3lEhF9doXcc5fwZYcuQ==","shasum":"d82c0b314ee2dfd88f94c0986784b3cd4cd407d7","tarball":"https://registry.npmjs.org/@brainsights/youtube-dl/-/youtube-dl-1.12.3.tgz","fileCount":22,"unpackedSize":49714,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCA18Mhc2apoy5VFEv6Wgyerq6ik7b09PBU4k+rLQt5FwIhAM431XtQ/KIMmpkdLziAyPXQfx60+BwfUKBIPFHWQrfM"}]},"maintainers":[{"name":"modeswitch","email":"npm@ack.modeswitch.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/youtube-dl_1.12.3_1520318296923_0.9143809342653775"},"_hasShrinkwrap":false},"1.12.4":{"name":"@brainsights/youtube-dl","description":"youtube-dl driver for node","keywords":["youtube","video","download"],"version":"1.12.4","repository":{"type":"git","url":"git://github.com/przemyslawpluta/node-youtube-dl.git"},"author":{"name":"Roly Fentanes","url":"https://github.com/fent"},"contributors":[{"name":"Przemyslaw Pluta","email":"przemyslawplutadev@gmail.com","url":"http://przemyslawpluta.com"},{"name":"Andrew Carlson","email":"andrew@stem.is"}],"main":"./lib/youtube-dl.js","directories":{"lib":"./lib"},"scripts":{"postinstall":"node ./scripts/download.js","update":"node ./scripts/download.js","test":"vows ./test/*.js --spec"},"dependencies":{"hh-mm-ss":"^1.2.0","mkdirp":"^0.5.1","request":"^2.83.0","streamify":"^0.2.9"},"devDependencies":{"vows":"*"},"license":"MIT","gitHead":"8cadd35a9ca37cb3fef2eb19f2fc67319f4a0f84","bugs":{"url":"https://github.com/przemyslawpluta/node-youtube-dl/issues"},"homepage":"https://github.com/przemyslawpluta/node-youtube-dl#readme","_id":"@brainsights/youtube-dl@1.12.4","_npmVersion":"6.1.0","_nodeVersion":"8.11.1","_npmUser":{"name":"modeswitch","email":"npm@ack.modeswitch.org"},"dist":{"integrity":"sha512-uF47osZVwBiYXmxVDyqUQnl2QmAqWLw3FrV4BqTsBvVMCP6vl4yVtIolDr64JBTd1gk+wtu5ozfZNp83fD6bGQ==","shasum":"55466e895310805223fca62e6a1a675df330c257","tarball":"https://registry.npmjs.org/@brainsights/youtube-dl/-/youtube-dl-1.12.4.tgz","fileCount":22,"unpackedSize":49848,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbUVfRCRA9TVsSAnZWagAAfjYP/1/84HLkOahnJONJs7nA\nCJeLZe4tcHv11PX6NL31HpswO6zvTmpyRgsyy1z1gTvhfRDI6dSnyU69OvB1\njNFcrCISZoCIpBTIRPvgg49FllxAWwuGGcWLQi1PkC3xvXF4vRuHz3VBmYia\nCBmPyNyC1qfmX+7Nb/0FXKAwMYvNaUJHE8PjNCTi75ELnHb6Gwxw1kBJtCWs\n5sP4Um5JKoGwNcTXhw5ZcJiLgxOj+NWOFemHawYGsmr4RUYE0SzSkRAtaaXp\nHxO3Xd6vkbK4RkZgE3W7ZYgKwK7Nl65GMdAO166KQoH6vsOQN7ce1WJQMt0L\nYOiju7XIzIAg4o7hIcZOWg4mWuW5ngrKxe1dStOvNT4iu+Zmb8Mk2Hy1VYyI\nLxV/1uoifrpBQiP1rzqu4eLKcH2JJTPY29wZLZsS7IsbuQgRsAGuKNZYMnjb\ngpAa62hVC9ql4kGnZPRat0bE3bcRa6TPPmz7lve595vSKvLQF9LUQKICF7fx\nGAtPsld6KVuPAkFeXJBaHpkL29jQVtxMVTwHapwzgJ8ozroGU7I6dvLvetDT\nu4vgUTmZiTJoVQCG9cezL+9AUqWd36/Fs5oSoU83AHu1Bst+hmTnA6/oOEbo\nO+czW3qJ4mfcdnppeieHEXqIIe+ScDyYAUWD1a1X7Y6Mb3Mr0Wr7yYu4VHj8\n3TEH\r\n=LIAs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCTXqV+dwwMCTzIkhuysrJZFdawjPHh/ZDvFMUYDTUbfwIhANh+f+yOPxlE+e/gfaR4nZXTrSAM67oS6dUr414cf0UR"}]},"maintainers":[{"name":"modeswitch","email":"npm@ack.modeswitch.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/youtube-dl_1.12.4_1532057553778_0.4628837675856725"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-06T06:38:16.923Z","1.12.3":"2018-03-06T06:38:16.988Z","modified":"2022-04-04T20:21:37.387Z","1.12.4":"2018-07-20T03:32:33.863Z"},"maintainers":[{"name":"modeswitch","email":"npm@ack.modeswitch.org"}],"description":"youtube-dl driver for node","homepage":"https://github.com/przemyslawpluta/node-youtube-dl#readme","keywords":["youtube","video","download"],"repository":{"type":"git","url":"git://github.com/przemyslawpluta/node-youtube-dl.git"},"contributors":[{"name":"Przemyslaw Pluta","email":"przemyslawplutadev@gmail.com","url":"http://przemyslawpluta.com"},{"name":"Andrew Carlson","email":"andrew@stem.is"}],"author":{"name":"Roly Fentanes","url":"https://github.com/fent"},"bugs":{"url":"https://github.com/przemyslawpluta/node-youtube-dl/issues"},"license":"MIT","readme":"# youtube-dl\n\n[![Build Status](https://travis-ci.org/przemyslawpluta/node-youtube-dl.svg?branch=master)](https://travis-ci.org/przemyslawpluta/node-youtube-dl) [![npm version](https://badge.fury.io/js/youtube-dl.svg)](https://badge.fury.io/js/youtube-dl) [![Dependency Status](https://gemnasium.com/przemyslawpluta/node-youtube-dl.svg)](https://gemnasium.com/przemyslawpluta/node-youtube-dl)\n\nDownload videos from youtube in node.js using [youtube-dl](http://rg3.github.com/youtube-dl/).\n\nIf you're only interested in downloading only from youtube, you should consider using [pure Javascript youtube downloading module](https://github.com/fent/node-ytdl).\n\n## Installation\n\nWith [npm](https://www.npmjs.com/) do:\n\n``` sh\nnpm install youtube-dl\n```\n\n## Usage\n\n### Downloading videos\n\n``` js\nvar fs = require('fs');\nvar youtubedl = require('youtube-dl');\nvar video = youtubedl('http://www.youtube.com/watch?v=90AiXO1pAiA',\n  // Optional arguments passed to youtube-dl.\n  ['--format=18'],\n  // Additional options can be given for calling `child_process.execFile()`.\n  { cwd: __dirname });\n\n// Will be called when the download starts.\nvideo.on('info', function(info) {\n  console.log('Download started');\n  console.log('filename: ' + info.filename);\n  console.log('size: ' + info.size);\n});\n\nvideo.pipe(fs.createWriteStream('myvideo.mp4'));\n```\n\nIt will produce an output that looks like the following when ran.\n\n```bash\nGot video info\nsaving to T-ara - Number Nine - MV - 티아라-Seku9G1kT0c.mp4\n100.00%\n```\n\n### Resuming partially downloaded videos\n\n``` js\nvar youtubedl = require('./');\nvar fs = require('fs');\nvar output = 'myvideo.mp4';\n\nvar downloaded = 0;\nif (fs.existsSync(output)) {\n  downloaded = fs.statSync(output).size;\n}\n\nvar video = youtubedl('https://www.youtube.com/watch?v=179MiZSibco',\n\n  // Optional arguments passed to youtube-dl.\n  ['--format=18'],\n\n  // start will be sent as a range header\n  { start: downloaded, cwd: __dirname });\n\n// Will be called when the download starts.\nvideo.on('info', function(info) {\n  console.log('Download started');\n  console.log('filename: ' + info._filename);\n\n  // info.size will be the amount to download, add\n  var total = info.size + downloaded;\n  console.log('size: ' + total);\n\n  if (downloaded > 0) {\n    // size will be the amount already downloaded\n    console.log('resuming from: ' + downloaded);\n\n    // display the remaining bytes to download\n    console.log('remaining bytes: ' + info.size);\n  }\n});\n\nvideo.pipe(fs.createWriteStream('myvideo.mp4', { flags: 'a' }));\n\n// Will be called if download was already completed and there is nothing more to download.\nvideo.on('complete', function complete(info) {\n  'use strict';\n  console.log('filename: ' + info._filename + ' already downloaded.');\n});\n\nvideo.on('end', function() {\n  console.log('finished downloading!');\n});\n```\n\nIt will produce an output that looks like the following when ran.\n\n**Output:**\n\n``` sh\n[~/nodejs/node-youtube-dl/example]$ node resume.js\nDownload started\nfilename: 1 1 1-179MiZSibco.mp4\nsize: 5109213\n^C\n```\n\n``` sh\n[~/nodejs/node-youtube-dl/example]$ node resume.js\nDownload started\nfilename: 1 1 1-179MiZSibco.mp4\nsize: 5109213\nresuming from: 917504\nremaining bytes: 4191709\nfinished downloading\n```\n\n### Getting video information\n\n``` js\nvar youtubedl = require('youtube-dl');\nvar url = 'http://www.youtube.com/watch?v=WKsjaOqDXgg';\n// Optional arguments passed to youtube-dl.\nvar options = ['--username=user', '--password=hunter2'];\nyoutubedl.getInfo(url, options, function(err, info) {\n  if (err) throw err;\n\n  console.log('id:', info.id);\n  console.log('title:', info.title);\n  console.log('url:', info.url);\n  console.log('thumbnail:', info.thumbnail);\n  console.log('description:', info.description);\n  console.log('filename:', info._filename);\n  console.log('format id:', info.format_id);\n});\n```\n\nRunning that will produce something like\n\n``` sh\nid: WKsjaOqDXgg\ntitle: Ace Rimmer to the Rescue\nurl: http://r5---sn-p5qlsn7e.c.youtube.com/videoplayback?ms=au&ip=160.79.125.18&cp=U0hWTFVQVl9FTENONl9NSlpDOjgtU1VsODlkVmRH&id=58ab2368ea835e08&source=youtube&expire=1377558202&factor=1.25&key=yt1&ipbits=8&mt=1377534150&itag=34&sver=3&upn=-rGWz2vYpN4&fexp=912306%2C927900%2C919395%2C926518%2C936203%2C913819%2C929117%2C929121%2C929906%2C929907%2C929922%2C929127%2C929129%2C929131%2C929930%2C925726%2C925720%2C925722%2C925718%2C929917%2C906945%2C929919%2C929933%2C912521%2C932306%2C913428%2C904830%2C919373%2C930803%2C908536%2C904122%2C938701%2C936308%2C909549%2C900816%2C912711%2C904494%2C904497%2C900375%2C906001&sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip%2Cipbits%2Citag%2Csource%2Cupn%2Cexpire&mv=m&burst=40&algorithm=throttle-factor&signature=ABD3A847684AD9B39331E567568D3FA0DCFA4776.7895521E130A042FB3625A17242CE3C02A4460B7&ratebypass=yes\nthumbnail: https://i1.ytimg.com/vi/WKsjaOqDXgg/hqdefault.jpg\ndescription: An old Red Dwarf eposide where Ace Rimmer saves the Princess Bonjella.\nfilename: Ace Rimmer to the Rescue-WKsjaOqDXgg.flv\nformat id: 34\n```\n\nYou can use an array of urls to produce an array of response objects with matching array index (e.g. the 1st response object will match the first url etc...)\n\n``` js\nvar youtubedl = require('youtube-dl');\nvar url1 = 'http://www.youtube.com/watch?v=WKsjaOqDXgg';\nvar url2 = 'https://vimeo.com/6586873';\nyoutubedl.getInfo([url1, url2], function(err, info) {\n  if (err) throw err;\n\n  console.log('title for the url1:', info[0].title);\n  console.log('title for the url2:', info[1].title);\n});\n```\n\n### Downloading subtitles\n\n``` js\nvar youtubedl = require('youtube-dl');\nvar url = 'https://youtu.be/PizwcirYuGY';\n\nvar options = {\n  // Write automatic subtitle file (youtube only)\n  auto: false,\n  // Downloads all the available subtitles.\n  all: false,\n  // Languages of subtitles to download, separated by commas.\n  lang: 'en',\n  // The directory to save the downloaded files in.\n  cwd: __dirname,\n};\nyoutubedl.getSubs(url, options, function(err, files) {\n  if (err) throw err;\n\n  console.log('subtitle files downloaded:', files);\n});\n```\n\n### Downloading thumbnails\n\n``` js\nvar youtubedl = require('youtube-dl');\nvar url = 'https://youtu.be/PizwcirYuGY';\n\nvar options = {\n  // Downloads available thumbnail.\n  all: false,\n  // The directory to save the downloaded files in.\n  cwd: __dirname,\n};\nyoutubedl.getThumbs(url, options, function(err, files) {\n  if (err) throw err;\n  console.log('thumbnail file downloaded:', files);\n});\n```\n\nFor 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][].\n\n### Downloading playlists\n\n``` js\n\nvar path = require('path');\nvar fs   = require('fs');\nvar ytdl = require('youtube-dl');\n\nfunction playlist(url) {\n\n  'use strict';\n  var video = ytdl(url);\n\n  video.on('error', function error(err) {\n    console.log('error 2:', err);\n  });\n\n  var size = 0;\n  video.on('info', function(info) {\n    size = info.size;\n    var output = path.join(__dirname + '/', size + '.mp4');\n    video.pipe(fs.createWriteStream(output));\n  });\n\n  var pos = 0;\n  video.on('data', function data(chunk) {\n    pos += chunk.length;\n    // `size` should not be 0 here.\n    if (size) {\n      var percent = (pos / size * 100).toFixed(2);\n      process.stdout.cursorTo(0);\n      process.stdout.clearLine(1);\n      process.stdout.write(percent + '%');\n    }\n  });\n\n  video.on('next', playlist);\n\n}\n\nplaylist('https://www.youtube.com/playlist?list=PLEFA9E9D96CB7F807');\n\n```\n\n### Getting the list of extractors\n\n``` js\nvar youtubedl = require('youtube-dl');\nyoutubedl.getExtractors(true, function(err, list) {\n  console.log('Found ' + list.length + ' extractors');\n  for (var i = 0; i < list.length; i++) {\n    console.log(list[i]);\n  }\n});\n```\n\nWill print something like\n\n``` sh\nFound 521 extractors\n1up.com\n220.ro\n24video\n3sat\n```\n\n### Call the `youtube-dl` binary directly\n\nThis module doesn't have `youtube-dl` download the video. Instead, it uses the `url` key from the `--dump-json` CLI option to create a node stream. That way, it can be used like any other node stream.\n\nIf that, or none of the above support your use case, you can use `ytdl.exec()` to call `youtube-dl` however you like.\n\n``` js\nytdl.exec(url, ['-x', '--audio-format', 'mp3'], {}, function(err, output) {\n  if (err) throw err;\n  console.log(output.join('\\n'));\n});\n```\n\n### Update\n\nSince the youtube-dl binary is updated regularly, you can run `npm run update` to check for and download any updates for it. You can also require `../lib/downloader` in your app if you'd like to place `youtube-dl` binary in a specific directory and control when it gets updates.\n\n``` js\nvar downloader = require('../lib/downloader');\n\ndownloader('path/to-binary', function error(err, done) {\n  'use strict';\n  if (err) { return console.log(err.stack); }\n  console.log(done);\n});\n```\n\n### Tests\n\nTests are written with [vows](http://vowsjs.org/)\n\n``` sh\nnpm test\n```\n\n## License\n\nMIT\n\n[youtube-dl]: http://rg3.github.com/youtube-dl/\n[youtube-dl documentation]: http://rg3.github.com/youtube-dl/documentation.html","readmeFilename":"README.md"}