Unable to handle Age-restricted videos
YoutubeExtractor currently cannot process videos that have age-restrictions.
Those are the videos which would normally show this prompt "This Video may be inappropriate for some users. Sign in to confirm your age" when you try to view them on YouTube website without signing in.
Please see if there is a way to circumvent this problem in YoutubeExtractor.
I have the same issue. Use this for example: https://www.youtube.com/watch?v=YJU7sLEpsH0
In Chrome, this is one method to bypass the "age-restricted" videos without signing in:
Change the standard YouTube URL from www.youtube.com/watch?v=xxxx to www.youtube.com/v/xxxx
Wonder if there's something similar that can be done programmatically to achieve the same age-restriction bypass?
Here are some more examples that YoutubeExtractor has problem handling:
https://www.youtube.com/watch?v=SMB4x11-NuY
https://www.youtube.com/watch?v=O3a_nyrYMZ0
Hopefully they will be fixed soon.
some info about this: YoutubeExtractor converts www.youtube.com/v/xxxx to www.youtube.com/watch?v=xxxx on DownloadUrlResolver.TryNormalizeYoutubeUrl that is called inside DownloadUrlResolver.GetDownloadUrls
so even if you try to put the /v/ format it will be converted automatically to the watch?v= format.
but if you go on the browser and use the /v/ format the video will be shown without the age restriction.
this is the html code you get if you use the https://www.youtube.com/v/YJU7sLEpsH0 (i know it's sad to repeat this URL it is a really bad video lol but this is an example video, don't even bother watching it please) on google chrome

i guess that the /v/ parameters specifies that only the video will be returned directly to the stream so the HttpHelper.DownloadString(url) called inside DownloadUrlResolver.LoadJson method will return strange wierd characters because it is actually a stream, and not UTF8 text.
i hope this helps.
Thanks for your input, rcitaliano.
So, is there a solution for YoutubeExtractor?
for sure there is, but I don't have the time now to do it, and i have no experience with the Newtonsoft.Json, i've got into this project because I wanted to download my youtube playlist as MP3, so I'm trying to do that first.
I'm having the same problem, can anybody help?
I found this:
http://stackoverflow.com/questions/33736103/checking-if-video-is-age-restricted-with-v3-of-youtube-api
YouTube API returns "ytRating": "ytAgeRestricted" for a restricted age video. You can try with the URL below.
https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=SMB4x11-NuY&key=APIKEY
was wondering if anybody found a solution to this. and i wanted to say that the link with the /v/ format is not a stream, if you open it with chrome view source it gives you gibberish, yes.. but inspect it and you will find elements and everything.. i dont know if it is encoded or what to be honest,, but most probably it is a player of some sort. i dont know. did anyone find a solution??
I found a solution to bypass this issue. Youtube need an logged in user that over 18 years old to watch this video. So all we need is attach valid cookies of a Youtube user to request the video url. You could attach cookie on method : JObject LoadJson(string url) in class DownloadUrlResolver. I tried and it works. There're many cookies on Youtube, as in my code, just use 2 cookies name: SID and SSID are enough.
@dhanh can you please provide an example of how to attach those cookies ?
@dhanh is correct in stating that the SID and SSID are the only cookies needed to bypass this. However, I do not know if or when these values change. Nonetheless, here is how to set them:
private static JObject LoadJson(string url)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.CookieContainer = new CookieContainer();
request.CookieContainer.Add(new Cookie(@"SID", @"SID GOES HERE") { Domain = "youtube.com" });
request.CookieContainer.Add(new Cookie(@"SSID", @"SSID GOES HERE") { Domain = "youtube.com" });
var response = (HttpWebResponse)request.GetResponse();
string pageSource;
using (var stream = new StreamReader(response.GetResponseStream()))
pageSource = stream.ReadToEnd();
...
Not the most graceful solution ever...
You can find these cookies by opening the dev tools in chrome, going to the network tab, recording the video page loading while signed into an 18+ account, and looking at the cookies sent in the watch page request.
Since the DownloadUrlResolver class is entirely static, I'm not going to commit anything as it would likely require some serious refactoring. I'll leave it to the user or the author to implement this instead.
Here's an example of an age-restricted video with the old comment system from 2007 by RHochstenbach. https://www.youtube.com/watch?v=D_-_F21V5IE
Any solution yet?
I am downloading video/audio from YouTube using C#. But i am getting this error again and again.I have tried different URL even kids or various video's but didn't work for me Error is Video is removed or has an age restriction Please help me out.
- https://www.youtube.com/watch?v=UoT2oava9ns
- https://www.youtube.com/watch?v=NtzftGb0EcM

Thanks
I also have the same problem
same