27 lines
619 B
JavaScript
27 lines
619 B
JavaScript
const { spawn } = require('child_process');
|
|
|
|
|
|
function seep(time){
|
|
return new Promise((res)=>{
|
|
setTimeout(()=>{
|
|
res()
|
|
},time)
|
|
})
|
|
}
|
|
|
|
function dow(info,callback){
|
|
const lux = spawn("./bin/yt-dlp.exe", ['--cookies-from-browser', 'chrome', '-P', info.save, '-o', info.title + '.mp4', info.url])
|
|
lux.stdout.on('data', (data) => {
|
|
console.log(String(data))
|
|
callback(String(data),false)
|
|
});
|
|
lux.on('close', (code) => {
|
|
console.log("结束")
|
|
callback(code,true)
|
|
});
|
|
}
|
|
|
|
module.exports = {
|
|
seep,
|
|
dow
|
|
} |