2023-06-12 15:20:45 +08:00
|
|
|
const { spawn } = require('child_process');
|
|
|
|
|
|
|
|
|
|
|
|
function seep(time){
|
|
|
|
return new Promise((res)=>{
|
|
|
|
setTimeout(()=>{
|
|
|
|
res()
|
|
|
|
},time)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function dow(info,callback){
|
2023-06-14 22:12:10 +08:00
|
|
|
const lux = spawn("./bin/yt-dlp.exe", ['--cookies-from-browser', 'chrome', '-P', info.save, '-o', info.title + '.mp4', info.url])
|
2023-06-12 15:20:45 +08:00
|
|
|
lux.stdout.on('data', (data) => {
|
2023-06-14 15:43:04 +08:00
|
|
|
console.log(String(data))
|
|
|
|
callback(String(data),false)
|
2023-06-12 15:20:45 +08:00
|
|
|
});
|
|
|
|
lux.on('close', (code) => {
|
|
|
|
console.log("结束")
|
|
|
|
callback(code,true)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
seep,
|
|
|
|
dow
|
|
|
|
}
|