Last active
August 31, 2016 02:58
-
-
Save nazimamin/2965eda32f630c1c53232c684f680116 to your computer and use it in GitHub Desktop.
mass download videos from youtube
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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