Answer the question
In order to leave comments, you need to log in
Is it possible to download videos using nodejs?
I got the episode playlist from the site . Is it possible to download them to a computer using Node.js? In my head, only form a list of links from download. I will be glad and literature.
Answer the question
In order to leave comments, you need to log in
var fs = require('fs')
, request = require('request');
request.get('http://fs.moviestape.net/video/1c4ed0ac8b7d5b4de6c5d58e2ea31a63/serials/Narcos/s01/Narcos.S01E01.mp4')
.on('error', function(err) {
console.error(err);
})
.on('response', function(res) {
console.log(res.statusCode);
console.log(res.headers['content-type']);
})
.pipe(fs.createWriteStream('Narcos.S01E01.mp4'))
.on('finish', function() {
console.log('OK');
});
var fs = require("fs"),
request = require("request");
const download = (uri, filename, callback) => {
request.head(uri, (err, res, body) => {
request(uri)
.pipe(fs.createWriteStream(filename))
.on("close", callback);
});
};
download(
"http://fs.moviestape.net/video/1c4ed0ac8b7d5b4de6c5d58e2ea31a63/serials/Narcos/s01/Narcos.S01E01.mp4",
"./downloads/filename.mp4",
() => {
console.log("done");
}
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question