omansak / libvideo

A lightweight .NET library to download YouTube videos.
BSD 2-Clause "Simplified" License
538 stars 163 forks source link

GetAllVideos not working #284

Closed noammaoz508 closed 1 month ago

noammaoz508 commented 2 months ago

I have upgraded to the new version the GetAllVideos function is not working. The following is my code: var url = "https://www.youtube.com/watch?v=Sf5XYmNlhpY"; var youtube = YouTube.Default; var videos = youtube.GetAllVideos(url).ToList(); var audios = videos.Where(video => video.AdaptiveKind == AdaptiveKind.Audio).OrderByDescending(video => video.AudioBitrate).ToList(); var audio = audios.First();

    if (audio != null && audio.Format == VideoFormat.Mp4) {
        var bSong = audio.GetBytes();
        MessageBox.Show("Audio File");
    } else {
        var video = youtube.GetVideo(url);
        var bSong = video.GetBytes();
        MessageBox.Show("video File");
    }

Getting the video only is working fine: var video = youtube.GetVideo(url); var bSong = video.GetBytes();

Any idea why it's not working?

omansak commented 2 months ago

@noammaoz508 did u try this on last version ?

notorious-bd commented 2 months ago

The new version resolves the following error:

System.Net.Http.HttpRequestException HResult=0x80131500 Message=Response status code does not indicate success: 403 (Forbidden).

Thank You!

noammaoz508 commented 2 months ago

Yes. I'm using the latest version 3.2.4

noammaoz508 commented 1 month ago

Any idea how to solve this problem of the GetAllVideos?

omansak commented 1 month ago

@noammaoz508 Can you test version 3.45