const { spawn } = require('child_process');
const { getListData } = require("./util/getList/qq.js")


// const lux = spawn("./bin/yt-dlp.exe",['--cookies-from-browser','edge','-P','D:/dl','-o','title.mp4','https://v.qq.com/x/cover/mzc00200ecukm2c/h0042bd9uig.html'])

// lux.stdout.on('data', (data) => {
//     console.log(`stdout: ${data}`);
// });

// lux.stderr.on('data', (data) => {
//     console.log(`stderr: ${data}`);
// });

// lux.on('close', (code) => {
//     console.log(`child process exited with code ${code}`);
// });


getListData('https://v.qq.com/x/cover/mzc0020009mj4p1/u0046tnchh7.html').then((res) => {
    for (let i of res) {
        const lux = spawn("./bin/yt-dlp.exe", ['--cookies-from-browser', 'edge', '-P', 'D:/dl', '-o', i.title + '.mp4', i.url])
        lux.stdout.on('data', (data) => {
            console.log(`stdout: ${data}`);
        });

        lux.stderr.on('data', (data) => {
            console.log(`stderr: ${data}`);
        });

        lux.on('close', (code) => {
            console.log(`child process exited with code ${code}`);
        });

    }
})