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', 'edge', '-P', 'D:/dl', '-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
}