Skip to content

Instantly share code, notes, and snippets.

@nazimamin
Last active August 31, 2016 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nazimamin/2965eda32f630c1c53232c684f680116 to your computer and use it in GitHub Desktop.
Save nazimamin/2965eda32f630c1c53232c684f680116 to your computer and use it in GitHub Desktop.
mass download videos from youtube
var HOST = 'https://###.firebaseio.com/items.json'
var fs = require('fs')
var datapath = __dirname + '/videos'
var exec = require("child_process").execSync
var request = require('request')
request(HOST, function (err, res, body) {
if (res.statusCode == 200) {
var result = JSON.parse(body);
for (var key in result) {
if (result.hasOwnProperty(key)) {
var temp = result[key];
for (var item in temp) {
console.log('now downloading ' + item)
var cmd = 'youtube-dl https://www.youtube.com/watch\?v\=' + item + ' --format mp4';
console.log(cmd)
exec(cmd, function (error, stdout, stderr) {
console.log('Starting download')
console.log(stdout);
});
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment