microlinkhq / youtube-dl-exec

A simple Node.js wrapper for youtube-dl/yt-dlp.
MIT License
423 stars 75 forks source link

Not working after hosting on server #178

Closed jacktheboss220 closed 10 months ago

jacktheboss220 commented 10 months ago

Hello, when i'm running my code in local machine, it is working fine, this is the output - [ '[youtube] Extracting URL: https://youtube.com/watch?v=zgJPTTiCK2E\n' + '[youtube] zgJPTTiCK2E: Downloading webpage\n' + '[youtube] zgJPTTiCK2E: Downloading ios player API JSON\n' + '[youtube] zgJPTTiCK2E: Downloading android player API JSON\n' + '[youtube] zgJPTTiCK2E: Downloading m3u8 information\n' + '[info] zgJPTTiCK2E: Downloading 1 format(s): 140\n' + '[download] Destination: 8306.mp3\n' + '\r[download] 0.0% of 5.28MiB at Unknown B/s ETA Unknown\r[download] 0.1% of 5.28MiB at Unknown B/s ETA Unknown\r[download] 0.1% of 5.28Mi B at Unknown B/s ETA Unknown\r[download] 0.3% of 5.28MiB at 7.62MiB/s ETA 00:00 \r[download] 0.6% of 5.28MiB at 6.18MiB/s ETA 00:00\r[downloa d] 1.2% of 5.28MiB at 8.89MiB/s ETA 00:00\r[download] 2.3% of 5.28MiB at 12.50MiB/s ETA 00:00\r[download] 4.7% of 5.28MiB at 19.31MiB/s E TA 00:00\r[download] 9.4% of 5.28MiB at 29.53MiB/s ETA 00:00\r[download] 18.9% of 5.28MiB at 43.63MiB/s ETA 00:00\r[download] 37.9% of 5.28MiB at 51.39MiB/s ETA 00:00\r[download] 75.7% of 5.28MiB at 38.09MiB/s ETA 00:00\r[download] 100.0% of 5.28MiB at 35.93MiB/s ETA 00:00\r[download] 10 0% of 5.28MiB in 00:00:00 at 26.12MiB/s ' ]

But when i depoly my app on heroku this is not working like it search the youtube link but i dont know why it is not downloading the files

[ 2023-12-18T14:36:22.725136+00:00 app[web.1]: '[youtube] Extracting URL: https://youtube.com/watch?v=zgJPTTiCK2E\n' + 2023-12-18T14:36:22.725137+00:00 app[web.1]: '[youtube] WzlO79d3S8c: Downloading webpage\n' + 2023-12-18T14:36:22.725137+00:00 app[web.1]: '[youtube] WzlO79d3S8c: Downloading ios player API JSON\n' + 2023-12-18T14:36:22.725138+00:00 app[web.1]: '[youtube] WzlO79d3S8c: Downloading android player API JSON\n' + 2023-12-18T14:36:22.725138+00:00 app[web.1]: '[youtube] WzlO79d3S8c: Downloading m3u8 information\n' + 2023-12-18T14:36:22.725138+00:00 app[web.1]: '[info] WzlO79d3S8c: Downloading 1 format(s): 140' 2023-12-18T14:36:22.725139+00:00 app[web.1]: ]

My code

const stream = youtubedl(URL, { format: 'm4a', output: fileDown, maxFilesize: "104857600", preferFreeFormats: true, });
        await Promise.all([stream]).then(async (r) => {
            console.log(r);
            if (r?.includes("max-filesize")) {
                return sendMessageWTyping(from,
                    { text: "File size exceeds more then 100MB." },
                    { quoted: msg }
                )
            } else {
                let sock_data;
                if (command == 'song') {
                    sock_data = {
                        document: fs.readFileSync(fileDown),
                        mimetype: "audio/mpeg",
                        fileName: title + ".mp3",
                        ppt: true,
                    }
                } else {
                    sock_data = {
                        audio: fs.readFileSync(fileDown),
                        mimetype: "audio/mpeg",
                        fileName: fileDown,
                    }
                }
                await sock.sendMessage(from, sock_data, { quoted: msg });
                fs.unlinkSync(fileDown);
                console.log("Sent");
            }
        }).catch(err => {
            console.log(err);
            sendMessageWTyping(from, { text: err.toString() }, { quoted: msg });
        })

can u help?

Kikobeats commented 10 months ago

Hello, when I try to get that video it's returning the following error:

ERROR: [youtube] zgJPTTiCK2E: Video unavailable. This video is not available

So there is nothing I can do there ☹️

jacktheboss220 commented 10 months ago

oki