Tyrrrz / YoutubeExplode

Abstraction layer over YouTube's internal API
MIT License
2.86k stars 482 forks source link

Error: YoutubeExplode.Exceptions.VideoUnavailableException #808

Open Dopamax opened 2 weeks ago

Dopamax commented 2 weeks ago

Version

v6.4.0

Platform

.NET 8 / windows 10

Steps to reproduce

My blazor app work fine in local machine, but when I deployed it on azure app service, I got this error below

Details

[2024-09-01T15:34:42.052Z] Error: YoutubeExplode.Exceptions.VideoUnavailableException: Video 'CZr3pKM44wk' is not available. at YoutubeExplode.Videos.VideoController.GetVideoWatchPageAsync(VideoId videoId, CancellationToken cancellationToken) in //YoutubeExplode/Videos/VideoController.cs:line 39 at YoutubeExplode.Videos.VideoClient.GetAsync(VideoId videoId, CancellationToken cancellationToken) in //YoutubeExplode/Videos/VideoClient.cs:line 37 at YoutaBlazorWebApp.Application.YoutubeDownloader.GetYoutaQuality720pFileStream(String videoUrl) in C:\Users\clock\source\repos\YoutaBlazorWebApp\Application\YoutubeDownloader.cs:line 165 at YoutaBlazorWebApp.Components.Pages.Home.DownloadVideoFileQuality720p() in C:\Users\clock\source\repos\YoutaBlazorWebApp\Components\Pages\Home.razor:line 77 at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Checklist

Dopamax commented 1 week ago

@Tyrrrz what's the cause of the problem, and what's the solution ?

lukaszfiszer96 commented 1 week ago

same here. Locally works fine, but on azure server got VideoUnavailableException. Any ideas ?

okansarica commented 1 week ago

In my case this is happening when the page content doesn't contain of:URL meta tag. This happens most probably because the page is not accessible when banned from youtube but still there is json data in the content which might be used

socaciumugurel commented 4 days ago

My assumption, this is a duplicate of: https://github.com/Tyrrrz/YoutubeExplode/issues/794

I managed to reproduce this locally, and digging dipper in the library, GetVideoWatchPageAsync from VideoController throws an exception with the message: Sign in to confirm you’re not a bot (Would be useful if this message is thrown to the client) This message indicates that YouTube is flagging the request as potentially coming from an automated source, which could be tied to the IP address used by the machine. This could explain why it's working on some machines and not on others—YouTube may impose stricter checks based on the IP reputation or the traffic pattern.

Key Takeaways:

Potential Solutions: