youtube-dl: [youtube] Age-gate bypass does not work because of get_video_info returning 404

Checklist

  • I’m reporting a bug report
  • I’ve verified that I’m running youtube-dl version 2021.05.16
  • I’ve checked that all provided URLs are alive and playable in a browser
  • I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • I’ve searched the bugtracker for similar bug reports including closed ones
  • I’ve read bugs section in FAQ

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-sv', 'Tq92D6wQ1mg']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.05.16
[debug]        from commit 9aad8cd18
[debug]           based on a72600998
[debug] Git HEAD: 8248d5fba
[debug] Python version 3.9.5 (CPython) - Linux-5.11.0-051100-generic-x86_64-with-glibc2.31
[debug] exe versions: ffmpeg 4.2.4, ffprobe 4.2.4, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] Tq92D6wQ1mg: Downloading webpage
[youtube] [debug] Fetching webpage from https://www.youtube.com/watch?v=Tq92D6wQ1mg&bpctr=9999999999&has_verified=1
[youtube] trying regex ;ytplayer\.config\s*=\s*({.+?});ytplayer
[youtube] trying regex ;ytplayer\.config\s*=\s*({.+?});
[youtube] trying regex (?m)window\["ytInitialPlayerResponse"\]\s*=\s*({.+});$
[youtube] trying regex ytInitialPlayerResponse\s*=\s*({.+?})\s*;\s*(?:var\s+meta|</script|if\s*\(window\.ytcsi\)|\n)
[youtube] ytInitialPlayerResponse\s*=\s*({.+?})\s*;\s*(?:var\s+meta|</script|if\s*\(window\.ytcsi\)|\n) found
[youtube] Tq92D6wQ1mg: Refetching age-gated info webpage
[youtube] [debug] Fetching webpage from https://www.youtube.com/get_video_info?video_id=Tq92D6wQ1mg&eurl=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FTq92D6wQ1mg
WARNING: unable to download video info webpage: HTTP Error 404: Not Found
ERROR: Sign in to confirm your age
This video may be inappropriate for some users.
Traceback (most recent call last):
  File "/home/lesmi/youtube-dl/youtube_dl/YoutubeDL.py", line 876, in wrapper
    return func(self, *args, **kwargs)
  File "/home/lesmi/youtube-dl/youtube_dl/YoutubeDL.py", line 907, in __extract_info
    ie_result = ie.extract(url)
  File "/home/lesmi/youtube-dl/youtube_dl/extractor/common.py", line 553, in extract
    ie_result = self._real_extract(url)
  File "/home/lesmi/youtube-dl/youtube_dl/extractor/youtube.py", line 1743, in _real_extract
    raise ExtractorError(reason, expected=True)
youtube_dl.utils.ExtractorError: Sign in to confirm your age
This video may be inappropriate for some users.

Description

Given an age-restricted video like this one, youtube-dl used to workaround it by using get_video_info call. But it seems it’s not available anymore.

This is not lethal because when I provided --cookies option then it works normally.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 18
  • Comments: 48 (19 by maintainers)

Commits related to this issue

Most upvoted comments

@colethedj

Sorry for the double post but this is the first issue a came by when i googled so:

I dont know if this helps but if you want to let get_video_info link to work for now you can add : &html5=1 to the link. You will get something like this: https://www.youtube.com/get_video_info?html5=1&video_id={videoID}.

I rewrote the code to use innertube instead, and age-gate bypassing worked for embeddedable videos. It’ll fail if the video can’t be embedded, since it’s mimicking embedded client. https://github.com/ytdl-patched/ytdl-patched/commit/7371d30ec1040afcbe94b3d6ff1a28b137dc65b5

I am also getting 404 sometimes now. It is not consistent. Retrying a couple of times does “fix” it right now, but this is generally a sign that the API is being shut down 😢

Does anyone know how to do age-gate bypass using the innertube API?

@colethedj I’m in the EU, I can access tier 1 & 2 videos with yt-dlp just fine. Tier 3 doesn’t work here either. I however can indeed not access any of those videos on the YouTube website itself without verifying my age.

In summary:

The current known age-gate bypasses (get_video_info & embedded API clients) don’t work on all videos. We consider these videos that don’t work “Tier 3” - some more information here: https://github.com/yt-dlp/yt-dlp/pull/328#issuecomment-864117168

This is assuming you’re not in the EU, which if you are the above probably does not apply and you require cookies from an account that is age-verified regardless (correct me if I’m wrong - not in the EU myself!).

Both youtube-dl and yt-dlp have working support for tier 2 bypass. However, the tier 2 bypass in youtube-dl current release is broken. It is fixed in master, but for whatever reason there hasn’t been a release with it 😕


Also good to note get_video_info appears to only be disabled on web clients at this stage. Other non-web clients appear to work with it (can confirm myself that TVHTML5 & ANDROID work with it atm)

It is only using get_video_info if the initial watch page gives an age gate error.

Cookies method will only work if you can play the video in the browser with your account.

-------- Original Message -------- On 21 May 2021, 19:18, MikeTester21 wrote:

colethedj, I am trying the -cookies way and it does not work. Using a video example from first post (I just want to get video URL, not download it), this is what I use:

youtube-dl -g --cookies cookies.txt https://www.youtube.com/watch?v=Tq92D6wQ1mg

WARNING: unable to download video info webpage: HTTP Error 404: Not Found

I updated to latest version 2021.05.16

Apologies for question, I am new to youtube-dl, but is youtube-dl utilizing get_video_info method for downloading/getting youtube video info? Because right now I am using a different plugin that calls get_video_info, but if youtube-dl uses the same thing for age-restricted vidos then if get_video_info dies then youtube-dl will sadly also not help.

I just received updated YT terms and it says : “YouTube’s right to monetize: YouTube has the right to monetize all content on the platform and ads may appear on videos from channels not in the YouTube Partner Program” . I am really disliking google, they keep closing door after door for developers. and they ae rally getting greedier with every move.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

@3unjee New API is the youtubei ones, e.g. https://www.youtube.com/youtubei/v1/<ep>. All of YouTube’s apps seem to have transitioned to this nowadays (web, mobile, tv, etc.)

Is it a POST request ??

Also… what is < ep > ??

Thanks!!!

Prob getting a bit off-topic here.

Yes, POST. <ep> is the endpoint, e.g. browse, player, next.

If you watch your browser network activity on YouTube (filter by XHR) you should be able to see these requests. There’s a bunch of required params/payload data you need too.

https://github.com/tombulled/innertube might be useful for toying around with it (still in the works I think).

I can also confirm I am getting intermittent 404’s (not in the EU). I have also observed the TV web ui has moved to the new api now (previously it was using the get_video_info endpoint not too long ago).

Do you know which API they are using ?

@3unjee New API is the youtubei ones, e.g. https://www.youtube.com/youtubei/v1/<ep>. All of YouTube’s apps seem to have transitioned to this nowadays (web, mobile, tv, etc.)

3unjee , for me it works even without embedded flag, but html5=1 is a must.

The reason I am asking about alternatives (like the youtube.com/watch you mentioned) is because I think it is just a matter of time google kills html5=1 workaround too.

So how will you transition to youtube.com/watch or what will you use if get_video_info with html5=1 workaround gets killed?