omansak / libvideo

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

Not all video resolution ara available #174

Closed GDMarconetto closed 3 years ago

GDMarconetto commented 4 years ago

Hi all, i have a strange problem with one YouTube video.

For an application i need the direct uri to the video to play it, so here is what i'm doing:

List<YouTubeVideo> videos = YouTube.Default
                    .GetAllVideos(url)
                    .ToList();

 if (videos != null && videos.Count > 0)
 {
      videos = videos
              .Where(v => v.Resolution <= Configuration.VIDEO_WANTED_RESOLUTION)
              .OrderByDescending(v => v.Resolution)
              .ToList();

              if (videos.Count > 0)
             {
                  return videos.FirstOrDefault();
             }
  }

Than i can this to get the Uri: video.Uri;

With this YouTube video i get that for some resolution (like 720p) ContentLenght = 0 and Uri return a error page.

It's normal ? Depends on the video ? This some day ago working perfectly.

Thanks!

banderberg commented 4 years ago

You can also specify the query string param vq=hd1080 for example to get 1080p, and the video downloaded is the same size with or without it, and is clearly NOT 1080p.

omansak commented 3 years ago

Thank you for feedback. i will look this issue as soon

HaseebUllahAbbasi commented 3 years ago

@omansak Have you set your own resolution , did you succeed?

XdGoldenTigerOfficial commented 3 years ago

@omansak Have you set your own resolution , did you succeed?

@HaseebUllahAbbasi, Yeah. you just have to add &vq=hd1080 to the end of the url. Here is a link showing how you can change the resolution/fullscreen via the URL: Here

omansak commented 3 years ago

please test #201

omansak commented 3 years ago

added new formats