m3u8-downloader-multi-thread
v1.1.2
Published
M3u8 downloader - Multi Thread/Auto Merge/Event Monitor/Custom HTTP Referrer
Downloads
3
Maintainers
Readme
m3u8-downloader
M3u8 downloader - Multi Thread/Auto Merge/Event Monitor/Custom HTTP Referrer
****Pure Javascript
How to use
Shell
npm install m3u8-downloader-concurrency --save
Javascript
let url = 'https://abc.com/video28912030123/index.m3u8'; //required
let outputDir = '/Users/xxxx/Downloads/tmp'; //required
// let outputFileName = 'output.ts'; //optional
// let threadCount = 5; //optional
// let videoUrlDirPath = 'https://abc.com/video28912030123/'; //optional
// let headerReferrer = 'https://abc.com'; //optional
// let videoSuffix = '.ts'; //optional
// let retryOnError = true; //optional
let downloader = require('m3u8-downloader-concurrency')
let listener = downloader.download({
url,
outputDir,
// outputFileName,
// threadCount,
// videoSuffix,
// videoUrlDirPath,
// headerReferrer,
// retryOnError
})
listener.on('start', function (d) {
console.log("started downloading");
});
listener.on('progress', function (d) {
console.log(d);
});
listener.on('downloaded', function (d) {
console.log('downloaded', d);
});
listener.on('complete', function (d) {
console.log('done', d);
});
listener.on('error', function (e) {
console.error('error', e);
});