How can I make a NodeJS script to download videos from a CSV list. So far I can only download images in HTTP, but I could't figure out how to workaround for video and HTTPS. Your advice is appreciated. Below is my code to download Images.
var fs = require('fs');
var promiseCSV = require('./promiseCSV.js');
var request = require('request');
var path = "test.csv"
var download = function(uri, filename, callback){
request.head(uri, function(err, res, body){
request(uri).pipe(fs.createWriteStream(filename)).on('close', callback);
});
};
var i = 0;
promiseCSV(path).then(function (records) {
next();
function next(){
download(records[i][0],'image/'+records[i][1], function(){
i++;
if (i < records.length) next();
});
}
});
via Noob9999
No comments:
Post a Comment