Skip to content

Unable to download video (403 Forbidden) #853

Closed

Description

@worbarry

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

Activity

  1. Tyrrrz commented on Dec 26, 2024

    @Tyrrrz
    Owner

    What video URL were you using?

  2. worbarry commented on Dec 26, 2024

    @worbarry
    Author
  3. dsimonubb commented on Dec 26, 2024

    @dsimonubb

    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.

  4. udi12 commented on Dec 29, 2024

    @udi12

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

  5. mohanadshaban commented on Dec 30, 2024

    @mohanadshaban

    Same here...

  6. udi12 commented on Dec 30, 2024

    @udi12

    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?

  7. udi12 commented on Jan 5, 2025

    @udi12

    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

  8. worbarry commented on Jan 5, 2025

    @worbarry
    Author
  9. wasd52030 commented on Jan 10, 2025

    @wasd52030

    Same here...

  10. logeshpalani33 commented on Jan 11, 2025

    @logeshpalani33

    same here

  11. flowhl commented on Jan 12, 2025

    @flowhl

    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#

  12. wisamidris77 commented on Jan 14, 2025

    @wisamidris77

    Same here

  13. vincetota commented on Jan 16, 2025

    @vincetota

    Same issue for me :(

  14. 32 remaining items

  15. changed the title [-] 403 (Forbidden) on any video[/-] [+]Unable to download video (`403 Forbidden`)[/+] on Oct 4, 2025
  16. shaked6540 commented on Oct 4, 2025

    @shaked6540
    Contributor

    I can sometimes reproduce this locally but not consistently. Any help is appreciated.

    From my experience, just spam video downloads or use a large playlist (around 1000 videos) and it will reproduce consistently. I think that its just youtube rate limiting and throwing a 403 error instead of the expected 429

  17. DotNet-Fan commented on Oct 14, 2025

    @DotNet-Fan

    Another observation: the “forbidden” issue now occurs consistently for all YouTube and YouTube Music URLs, but not seen for YouTube Shorts URLs. YTE v6.5.4

    This can be reproduced from YoutubeDownloader

  18. Speed258 commented on Oct 14, 2025

    @Speed258

    Another observation: the “forbidden” issue now occurs consistently for all YouTube and YouTube Music URLs, but not seen for YouTube Shorts URLs. YTE v6.5.4

    This can be reproduced from YoutubeDownloader

    Same with v6.5.5 (2025-10-13) tested and worked fine, today(2025-10-14) it seems was update from youtube all videos on GetManifestAsync returns with 403, usually it helped jumping from 6.5.1-6.5.4 versions, but today it completely blocked

  19. cabbry commented on Oct 15, 2025

    @cabbry

    It's working for GetManifestAsync, if you remove this request in StreamClient.cs (l. 71) file :

    using var response = await http.GetAsync( // Try to access the last byte of the stream MediaStream.GetSegmentUrl(url, contentLength.Value - 2, contentLength.Value - 1), HttpCompletionOption.ResponseHeadersRead, cancellationToken )

    But the problem is still here on DownloadAsync...

  20. Walter5923 commented on Oct 16, 2025

    @Walter5923

    Same here for about a week now. Until yesterday it helped, to get a new IP address by my ISP. Now this doesn’t work anymore. Every video fails with 403 forbidden. NewPipe 28.0 is not affected and still works. Thanks.

  21. ArtemIyX commented on Oct 17, 2025

    @ArtemIyX

    Same here

  22. Tyrrrz commented on Oct 17, 2025

    @Tyrrrz
    Owner

    YouTube updated to a new version and changed their player, along with a lot of behavior related to fetching streams.

  23. Duc558 commented on Oct 20, 2025

    @Duc558

    It works great here https://ytdown.io

  24. Al-tronic commented on Oct 23, 2025

    @Al-tronic

    As mentioned in this previous comment, there's an n parameter in the googlevideo.com links used to get stream chunks, and you'll get a 403 response if it's not present. One workaround I've found is, if you start playing a video in a web browser then copy the link it uses to get stream chunks, you can use that to send requests.

  25. Tyrrrz commented on Oct 25, 2025

    @Tyrrrz
    Owner

    Should be fixed via #919. Tested locally.

  26. konradw-dev commented on Oct 28, 2025

    @konradw-dev

    I attempted a similar fix, just didn't find the right client values myself. This seems to have taken care of it for me as well! Thanks @pictos & @Tyrrrz !

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions