Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 (Forbidden) on any video #853

Open
4 of 6 tasks
worbarry opened this issue Dec 22, 2024 · 12 comments
Open
4 of 6 tasks

403 (Forbidden) on any video #853

worbarry opened this issue Dec 22, 2024 · 12 comments

Comments

@worbarry
Copy link

worbarry commented Dec 22, 2024

Version

6.5.0

Platform

.NET 8

Steps to reproduce


static class Program
    {
        static async Task Main(string[] args)
        {
            Console.WriteLine("Youtube VideoDownloader");
            Console.WriteLine("");
            Console.Write("Enter URL: ");
            var videoUrl = Console.ReadLine();

            if (videoUrl != null)
            {
                await Download(videoUrl);
            }
            
        }

        private static async Task Download(string videoUrl)
        {
            var youtube = new YoutubeClient();
            
            var video = await youtube.Videos.GetAsync(videoUrl);
            var streamManifest = await youtube.Videos.Streams.GetManifestAsync(videoUrl);

            var streamInfo = streamManifest
                .GetVideoOnlyStreams()
                .Where(s => s.Container == Container.Mp4)
                .GetWithHighestVideoQuality();
            IProgress<double> progress = new Progress<double>(p => Console.Write($"Progress updated: {p}"));
            await youtube.Videos.Streams.DownloadAsync(streamInfo, $"video.{streamInfo.Container}", progress);
            
        }
    }

Details

Download video file

result
Unhandled exception. System.Net.Http.HttpRequestException: Response status code does not indicate success: 403 (Forbidden).

Checklist

  • I have looked through existing issues to make sure that this bug has not been reported before
  • I have provided a descriptive title for this issue
  • I have made sure that this bug is reproducible on the latest version of the package
  • I have provided all the information needed to reproduce this bug as efficiently as possible
  • I have sponsored this project
  • I have not read any of the above and just checked all the boxes to submit the issue
@worbarry worbarry added the bug label Dec 22, 2024
@Tyrrrz
Copy link
Owner

Tyrrrz commented Dec 26, 2024

What video URL were you using?

@worbarry
Copy link
Author

worbarry commented Dec 26, 2024 via email

@dsimonubb
Copy link

I get now also the 403 Firbidden error when calling
var streamManifest = await youtube.Videos.Streams.GetManifestAsync(video.Id); on all the videos I try.
I use also version 6.5.0.
A few days ago it still worked.

@udi12
Copy link

udi12 commented Dec 29, 2024

Screenshot 2024-12-29 215051
hi there
been trying this now, and getting "forbidden" on any video...

@mohanadshaban
Copy link

Same here...

@udi12
Copy link

udi12 commented Dec 30, 2024

Is this happening for every1 or is just my IP blocked?
Because with a browser, I can watch videos when logged-in.
In Incognito mode however, videos not playing... is this a block sign?

@udi12
Copy link

udi12 commented Jan 5, 2025

Well, it was a temporary block. I tried again after a few days and everything worked just fine. Maybe my IP was renewed by the ISP.

Please take a look at the downloader variant I have coded:
https://www.youtube.com/watch?v=cuSokN7jVCk

@worbarry
Copy link
Author

worbarry commented Jan 5, 2025 via email

@wasd52030
Copy link

Same here...

@logeshpalani33
Copy link

same here

@flowhl
Copy link

flowhl commented Jan 12, 2025

Same issue here on version 6.4.2 and 6.5.1:
System.Net.Http.HttpRequestException: 'Response status code does not indicate success: 403 (Forbidden).'
at last line of TryGetContentLengthAsync:

response.EnsureSuccessStatusCode();

Same issue with all videos I have tested. Location is Germany, if that matters. Same result on VPN. Using youtube in incognito mode works without problems. I can provide further information and help debugging if wanted.

Callstack:

[Exception] YoutubeExplode.dll!YoutubeExplode.Videos.Streams.StreamClient.TryGetContentLengthAsync(YoutubeExplode.Bridge.IStreamData streamData, string url, System.Threading.CancellationToken cancellationToken) Line 82 C#
[Exception] YoutubeExplode.dll!YoutubeExplode.Videos.Streams.StreamClient.GetStreamInfosAsync(System.Collections.Generic.IEnumerable<YoutubeExplode.Bridge.IStreamData> streamDatas, System.Threading.CancellationToken cancellationToken) Line 115 C#
[Exception] Microsoft.Bcl.AsyncInterfaces.dll!System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore.GetResult(short token) Unknown
[Exception] YoutubeExplode.dll!YoutubeExplode.Utils.Extensions.AsyncCollectionExtensions.ToListAsync(System.Collections.Generic.IAsyncEnumerable source) Line 49 C#
[Exception] YoutubeExplode.dll!YoutubeExplode.Utils.Extensions.AsyncCollectionExtensions.ToListAsync(System.Collections.Generic.IAsyncEnumerable source) Line 49 C#
[Exception] YoutubeExplode.dll!YoutubeExplode.Videos.Streams.StreamClient.GetStreamInfosAsync(YoutubeExplode.Videos.VideoId videoId, YoutubeExplode.Bridge.PlayerResponse playerResponse, System.Threading.CancellationToken cancellationToken) Line 230 C#
[Exception] YoutubeExplode.dll!YoutubeExplode.Videos.Streams.StreamClient.GetStreamInfosAsync(YoutubeExplode.Videos.VideoId videoId, System.Threading.CancellationToken cancellationToken) Line 275 C#
[Exception] YoutubeExplode.dll!YoutubeExplode.Videos.Streams.StreamClient.GetManifestAsync(YoutubeExplode.Videos.VideoId videoId, System.Threading.CancellationToken cancellationToken) Line 304 C#

@wisamidris77
Copy link

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants