youtube-to-html5-loader icon indicating copy to clipboard operation
youtube-to-html5-loader copied to clipboard

Error when trying to use some videos

Open kanestapler opened this issue 4 years ago • 7 comments

An example video that throws an error is https://www.youtube.com/watch?v=SbnQe6VQEWA.

My first guess is that it might have something to do with copyright causing the response from youtube to be in a different format.

parseYoutubeMeta returns an empty object which causes an error to be thrown due to selectedStream being null on the line below.

element.src = this.applyFilters( 'video.source', selectedStream.url, selectedStream, element, selectedFormat, streams );

Throwing the error vs failing quietly isn't really a huge issue, but I was hoping it was possible to make videos similar to the one above work. I am looking at the code in parseYoutubeMeta to see what is happening, but I'm not entirely following it just yet.

kanestapler avatar Dec 17 '20 19:12 kanestapler

I have the same problem.

Undefine selectedStream on Line 153 is null.

Chrome Console Reports: Uncaught (in promise) TypeError: Cannot read property 'url' of null at YouTubeToHtml5.js:1

Firefox Console Error Reports: Uncaught (in promise) TypeError: g is null loadSingle /YouTubeToHtml5.js:1

Christof0007 avatar Dec 20 '20 23:12 Christof0007

I looked into it for some time, but I didn't completely understand what was happening in the response from the youtube API. I will try to check again after the holidays if thelevicole hasn't found it by then.

kanestapler avatar Dec 21 '20 22:12 kanestapler

Roger that, great job for investigating.

I wonder, have you seen my other 'issue' post by the way? Are you having the same problem? https://github.com/thelevicole/youtube-to-html5-loader/issues/4

Christof0007 avatar Dec 22 '20 14:12 Christof0007

THIS PROJECT DEAD?

Christof0007 avatar Jan 14 '21 11:01 Christof0007

Hi all, sorry for the delay! It's been a v-busy new year with work and I haven't had time to respond to these issues.

An update will be pushed today to better handle the JS error. However, there is a larger issue at hand which is going to take some time and ongoing work to be resolved...

Some YouTube videos require a signature to be sent with the stream request. The signature is provided as a scrambled cipher that needs to be decoded before it can be used. The cipher and decoding process is regularly changing so replicating and decoding within the package client side is not viable. Each time the process changes on YouTubes end, we'd need to reverse engineer the decode process and release an update to this package.

At this time, I need to do more research into this and potentially deploy an API to handle the decode process to avoid the concerns mentioned above.

thelevicole avatar Jan 14 '21 14:01 thelevicole

@thelevicole Very much appreciate some fortunate people on not sat on Furlough, I've forgotten what it's like to be at work lol, fingers crossed back soon.

Fab to hear of your efforts in this interesting project. Thanks :+1:

Christof0007 avatar Jan 14 '21 14:01 Christof0007

Hi all v4.0.0 has been published which includes better error handling for unplayable streams. Please note that this update includes breaking changes so make sure you read the release notes for info.

Despite the new release, I am leaving this issue open until a soultion has been found for the signature decoding issue mentioned in my previous comment.

thelevicole avatar Jan 19 '21 16:01 thelevicole