iBicha / UnityYoutubePlayer

Play YouTube videos in Unity
The Unlicense
336 stars 63 forks source link

Exception: HTTP/1.1 500 Internal Server Error #46

Closed aadi3124 closed 3 years ago

aadi3124 commented 3 years ago

Exception: HTTP/1.1 500 Internal Server Error ResponseError:{"error":"Command failed: /app/tools/bin/youtube-dl -f \"best\" --dump-json https://youtu.be/NF56KaUlLz0?list=PLX6fIK545unrkeRhqGYVCUevzMCvV5Ypf\nERROR: Unable to download webpage: HTTP Error 429: Too Many Requests (caused by <HTTPError 429: 'Too Many Requests'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.\n","stderr":"ERROR: Unable to download webpage: HTTP Error 429: Too Many Requests (caused by <HTTPError 429: 'Too Many Requests'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.\n","stdout":""} System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at :0) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at :0) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at :0) System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at :0) System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () (at <fb001e01371b4adca20013e0ac763896>:0) YoutubePlayer.YoutubeDl+<GetVideoMetaDataAsync>d__51[T].MoveNext () (at Packages/com.ibicha.youtube-player/Runtime/YoutubeDl.cs:78) --- End of stack trace from previous location where exception was thrown --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at :0) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at :0) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at :0) System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at :0) System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () (at <fb001e01371b4adca20013e0ac763896>:0) YoutubePlayer.YoutubePlayer+<GetRawVideoUrlAsync>d__8.MoveNext () (at Packages/com.ibicha.youtube-player/Runtime/YoutubePlayer.cs:52) --- End of stack trace from previous location where exception was thrown --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <fb001e01371b4adca20013e0ac763896>:0) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <fb001e01371b4adca20013e0ac763896>:0) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <fb001e01371b4adca20013e0ac763896>:0) System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <fb001e01371b4adca20013e0ac763896>:0) System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () (at :0) YoutubePlayer.YoutubePlayer+d9.MoveNext () (at Packages/com.ibicha.youtube-player/Runtime/YoutubePlayer.cs:68) --- End of stack trace from previous location where exception was thrown --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at :0) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at :0) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at :0) System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at :0) System.Runtime.CompilerServices.TaskAwaiter.GetResult () (at :0) YoutubePlayer.PrepareYoutubeVideo+d2.MoveNext () (at Assets/YoutubePlayer/Scripts/PrepareYoutubeVideo.cs:14) --- End of stack trace from previous location where exception was thrown --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at :0) System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0 (System.Object state) (at :0) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at :0) UnityEngine.UnitySynchronizationContext:ExecuteTasks()

I have hosted my own youtube-dl, and there is no multiple users. Just testing with a single user, Still getting this. Please Help!. Thanks in Advance.

pnguyen2232 commented 3 years ago

I'm getting similar error. Exception: HTTP/1.1 503 Service Unavailable

All I've done is pull the repository and open with Unity 2019.4.0f1.

The following error is showing when it is played: image

iBicha commented 3 years ago

I have hosted my own youtube-dl, and there is no multiple users. Just testing with a single user, Still getting this. Please Help!. Thanks in Advance.

If this is the case (and you are sure you have the Unity project pointing to your own server), then this might mean that youtube identified you as not a real user. See https://github.com/iBicha/UnityYoutubePlayer/issues/36#issuecomment-781613628 It might make sense to add some caching mechanism to youtube-dl-server, or make it able to consume a cookie.txt file, but even that will not scale. I still don't have a good solution (and honestly I don't think there will be a stable one) I'm open to suggestions

I'm getting similar error. Exception: HTTP/1.1 503 Service Unavailable

All I've done is pull the repository and open with Unity 2019.4.0f1.

The following error is showing when it is played:

This error is because the free heroku instance is down (usually the last 9 days or so) because heroku only offers 550 of free dyno hours. (which are being used by all developers using this package, as well as their users).

See https://github.com/iBicha/UnityYoutubePlayer#how-do-i-host-my-own-youtube-dl-server

pnguyen2232 commented 3 years ago

I'm getting similar error. Exception: HTTP/1.1 503 Service Unavailable All I've done is pull the repository and open with Unity 2019.4.0f1. The following error is showing when it is played:

This error is because the free heroku instance is down (usually the last 9 days or so) because heroku only offers 550 of free dyno hours. (which are being used by all developers using this package, as well as their users).

See https://github.com/iBicha/UnityYoutubePlayer#how-do-i-host-my-own-youtube-dl-server

So I've set up a Keroku instance as per your link, thankyou for that. It no longer gives the 503 error.

Unfortunately, it's now giving an "Exception: HTTP/1.1 404 Not Found" which has happened before when Youtube does some update in the back end.

image

iBicha commented 3 years ago

So I've set up a Keroku instance as per your link, thankyou for that. It no longer gives the 503 error.

Unfortunately, it's now giving an "Exception: HTTP/1.1 404 Not Found" which has happened before when Youtube does some update in the back end.

Make sure that testing your new instance in the browser works e.g. https://my-instance.herokuapp.com/v1/video?url=https://www.youtube.com/watch?v=1PuGuqpHQGo

pnguyen2232 commented 3 years ago

So I've set up a Keroku instance as per your link, thankyou for that. It no longer gives the 503 error. Unfortunately, it's now giving an "Exception: HTTP/1.1 404 Not Found" which has happened before when Youtube does some update in the back end.

Make sure that testing your new instance in the browser works e.g. https://my-instance.herokuapp.com/v1/video?url=https://www.youtube.com/watch?v=1PuGuqpHQGo

This is the current output. I've now looked at several other unity assets and they seem to be having issues with youtube currently. image

iBicha commented 3 years ago

So I've set up a Keroku instance as per your link, thankyou for that. It no longer gives the 503 error. Unfortunately, it's now giving an "Exception: HTTP/1.1 404 Not Found" which has happened before when Youtube does some update in the back end.

Make sure that testing your new instance in the browser works e.g. https://my-instance.herokuapp.com/v1/video?url=https://www.youtube.com/watch?v=1PuGuqpHQGo

This is the current output image

And setting the url with YoutubeDl.ServerUrl = "https://my-instance.herokuapp.com"; doesn't work?

pnguyen2232 commented 3 years ago

And setting the url with YoutubeDl.ServerUrl = "https://my-instance.herokuapp.com"; doesn't work?

In the recently pulled project, I've manually changed the ServerURL (seen below) in the YoutubeDl.cs file in your package to our URL. I've also tried setting it on Awake inside the PlayVideo.cs file.

The above mentioned 404 error is a result of changing the ServerURL to our own link.

image

aadi3124 commented 3 years ago

Hi @iBicha Can I use this plugin for production. Is it a reliable plugin? I have hosted it on a free server right now. Please let me know. Thanks!

iBicha commented 3 years ago

Hi @iBicha Can I use this plugin for production. Is it a reliable plugin? I have hosted it on a free server right now. Please let me know. Thanks!

This plugin is not suited for production. It's because Youtube doesn't want you to play their videos outside of their website or player, since they monetize it and show ads. When they detect the request is coming from a server and not a user, they can request to solve a captcha (or even block IP address) which requires action to solve it. More details in https://github.com/ytdl-org/youtube-dl and online.

This plugin is good to get started to prototype, but should switch to more reliable hosting as a project becomes more serious.

And setting the url with YoutubeDl.ServerUrl = "https://my-instance.herokuapp.com"; doesn't work?

In the recently pulled project, I've manually changed the ServerURL (seen below) in the YoutubeDl.cs file in your package to our URL. I've also tried setting it on Awake inside the PlayVideo.cs file.

The above mentioned 404 error is a result of changing the ServerURL to our own link.

this might be some config issue on the hosted server, or maybe you added an extra / at the end of the url (https://my-instance.herokuapp.com vs https://my-instance.herokuapp.com/). Otherwise, I can't reproduce your issue without your url in question

iBicha commented 3 years ago

Since this issue is technically a HTTPError 429: 'Too Many Requests I will close this issue as a duplicate of #36 If there's different bug case, let's keep things in separate issues to track them properly. Thanks

pnguyen2232 commented 3 years ago

Hi @iBicha Can I use this plugin for production. Is it a reliable plugin? I have hosted it on a free server right now. Please let me know. Thanks!

This plugin is not suited for production. It's because Youtube doesn't want you to play their videos outside of their website or player, since they monetize it and show ads. When they detect the request is coming from a server and not a user, they can request to solve a captcha (or even block IP address) which requires action to solve it. More details in https://github.com/ytdl-org/youtube-dl and online.

This plugin is good to get started to prototype, but should switch to more reliable hosting as a project becomes more serious.

And setting the url with YoutubeDl.ServerUrl = "https://my-instance.herokuapp.com"; doesn't work?

In the recently pulled project, I've manually changed the ServerURL (seen below) in the YoutubeDl.cs file in your package to our URL. I've also tried setting it on Awake inside the PlayVideo.cs file. The above mentioned 404 error is a result of changing the ServerURL to our own link.

this might be some config issue on the hosted server, or maybe you added an extra / at the end of the url (https://my-instance.herokuapp.com vs https://my-instance.herokuapp.com/). Otherwise, I can't reproduce your issue without your url in question

You are correct, it was indeed the extra forward slash causing the problem

detraxo commented 3 years ago

Hi @iBicha Can I use this plugin for production. Is it a reliable plugin? I have hosted it on a free server right now. Please let me know. Thanks!

This plugin is not suited for production. It's because Youtube doesn't want you to play their videos outside of their website or player, since they monetize it and show ads. When they detect the request is coming from a server and not a user, they can request to solve a captcha (or even block IP address) which requires action to solve it. More details in https://github.com/ytdl-org/youtube-dl and online.

This plugin is good to get started to prototype, but should switch to more reliable hosting as a project becomes more serious.

And setting the url with YoutubeDl.ServerUrl = "https://my-instance.herokuapp.com"; doesn't work?

In the recently pulled project, I've manually changed the ServerURL (seen below) in the YoutubeDl.cs file in your package to our URL. I've also tried setting it on Awake inside the PlayVideo.cs file. The above mentioned 404 error is a result of changing the ServerURL to our own link.

this might be some config issue on the hosted server, or maybe you added an extra / at the end of the url (https://my-instance.herokuapp.com vs https://my-instance.herokuapp.com/). Otherwise, I can't reproduce your issue without your url in question

This helped me, thank you so much.