omansak / libvideo

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

Error Geting some videos #196

Closed arogerm closed 3 years ago

arogerm commented 3 years ago

Deal all 1.- If you try download some videos as var youTube = YouTube.Default;// starting point for YouTube actions var video = youTube.GetVideo("https://www.youtube.com/watch?v=952lvP709kk"); // gets a Video object with info about the video the program return an error

2.- It's possible get the video with this king of urls https://www.youtube-nocookie.com/embed/952lvP709kk ?

Other videos with error GaKeF0RLKzc IbeEiNrtqrU

omansak commented 3 years ago

I have tested it and its seems no problem idk.

arogerm commented 3 years ago

var videoInfos = cli.GetAllVideosAsync(uri).GetAwaiter().GetResult(); don't return error but don't get any video var videoInfos1 = cli.GetVideoAsync(uri).GetAwaiter().GetResult(); return error Sequence contains no elements

mheitmeijer commented 3 years ago

Issues is being caused by the consent page Youtube returns. Did some quick testing and a request like "https://consent.youtube.com/m?continue=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-EbF6qz9m20&gl=NL&m=0&pc=yt&uxe=23983172&hl=en&src=1" will download the movie "https://www.youtube.com/watch?v=-EbF6qz9m20". If you skip the "TryNormalize" method, because it isn't a valid url according the method. So that needs to be changed.

Or there should be a new method which will encode the url and the "consent.youtube.com", etc.

Or the first response should be checked for a consent page and then an extra call could be made with the "consent.youtube.com...." to get the movie

arogerm commented 3 years ago

I think that the 3 Option it's the best Or the first response should be checked for a consent page and then an extra call could be made with the "consent.youtube.com...." to get the movie I try to modified de code

omansak commented 3 years ago

image

idk. is this not valid. ?

arogerm commented 3 years ago

I don't undersrtand nothing 5 day ago the 3 ids return error, 952lvP709kk, GaKeF0RLKzc and IbeEiNrtqrU now only return error this id GaKeF0RLKzc

omansak commented 3 years ago

can you give all error text ?

omansak commented 3 years ago

please test #201

omansak commented 3 years ago

please test 3.1.1 on github and nuget