Closed anast3t closed 3 years ago
To avoid 403 you need referer field in request header. So you need to send request from server (eg localhost). But now the problem is that google fixed something and request returns constant 404
My videos don't load since yesterday and I noticed the same issue on my console :
GET https://images21-focus-opensocial.googleusercontent.com/gadgets/proxy?container=none&url=https%3A%2F%2Fwww.youtube.com%2Fget_video_info%3Fvideo_id%3DYizPn42SO6o%26el%3Dembedded%26hl%3Den_US 404
:(
Guess YT updated due to Copyright and such ...
So we can't use this lib anymore ?
So we can't use this lib anymore ?
There could be some fix, maybe. However using YT Content in a Player Other than YT Player surely isn't intended by YT and maybe against YT TOS as well. If you rely on it working stable I suggest to use the js api.
This CAN be fixed because there are still websites from which you can download (like savefrom.net, on main page you can find nonYT player)
I found what you can use instead of this lib for now: ytdl-core. It returns exactly same data-streaming urls. Maybe i'll try to fix this lib with the source code of that :)
example of usage (vue):
I've just published version 4.0.1 which contains a quick fix for this issue.
Instead of making responses directly to the YouTube/Google endpoints, I have setup a middleware API (https://yt2html5.com/
) to handle the retrieval of video information. It's currently on a shared server so please do not expect rapid responses.
Over the next couple of weeks I will be testing and improving the library and API so keep an eye out for future releases.
Let me know how you get on.
When loading player, there is extremly high chance to get 404 or 403 on responce (even on example page). As temporary solution i just filter them in loop, but maybe it can be fixed.
(code example, maybe i'm just doing something wrong)
delay: