Luuk-Dev / YT-Stream

Create easily readable streams from YouTube video url's
MIT License
23 stars 4 forks source link

Crashing on some videos #1

Closed Hydro001 closed 2 years ago

Hydro001 commented 2 years ago

Hi, When trying to play this particular video : https://www.youtube.com/watch?v=aA6zYJNPWXI With this code :

const ytstream = require('yt-stream');

const stream = await ytstream.stream("https://www.youtube.com/watch?v=aA6zYJNPWXI", {
    quality: 'high',
    type: 'audio',
    highWaterMark: 1048576 * 32
});

I get in this in the console :

C:\Users\User\Documents\Bots\Bot1\node_modules\yt-stream\src\stream\createstream.js:65
        var { url } = selectedFormat;
              ^

TypeError: Cannot destructure property 'url' of 'selectedFormat' as it is null.
    at C:\Users\User\Documents\Bots\Bot1\node_modules\yt-stream\src\stream\createstream.js:65:15
    at new Promise (<anonymous>)
    at getStreamURL (C:\Users\User\Documents\Bots\Bot1\node_modules\yt-stream\src\stream\createstream.js:36:12)
    at C:\Users\User\Documents\Bots\Bot1\node_modules\yt-stream\src\stream\createstream.js:88:30
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.0.0

I think that it happens because the video doesn't have audio only as it's an old one and because type: 'audio' is specified in the streaming option it doesn't find the proper format, it's just a matter of playing an arbitrary stream if it doesn't find the proprer format, good luck.

Thanks for reading and have a nice day 👍

Luuk-Dev commented 2 years ago

Thank you for reporting this issue. I'll look into it as soon as possible. I'll let you know when I solved it and you can install the new version. Have a nice day!

Luuk-Dev commented 2 years ago

I've just uploaded a new version which should solve this bug. If you find another bug or still are having trouble downloading the video, feel free to re-open this issue or open another one.

Hydro001 commented 2 years ago

It works fine now, thank you so much. Though i have another problem, i'm unable to play live streams, i will open another issue.