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)
Links to this issue
Commits related to this issue
- [youtube] Add `html5=1` param to `get_video_info` page requests (#329) Workaround for #319, https://github.com/ytdl-org/youtube-dl/issues/29086 Authored by: colethedj — committed to yt-dlp/yt-dlp by coletdjnz 3 years ago
- Fix 404 errors on scheduled live events and age-gate bypass get_video_info now returns 404 error. Adding html5=1 fixes it (for now). See https://github.com/ytdl-org/youtube-dl/issues/29086#issuecomme... — committed to user234683/youtube-local by user234683 3 years ago
- [youtube] Temporary fix for age-gate Related: https://stackoverflow.com/a/67629882 https://github.com/yt-dlp/yt-dlp/issues/319 https://github.com/ytdl-org/youtube-dl/issues/29333 https://github.com/y... — committed to yt-dlp/yt-dlp by pukkandan 3 years ago
- [youtube] Use new API for additional video extraction requests (#328) Co-authored-by: colethedj, pukkandan Closes https://github.com/yt-dlp/yt-dlp/issues/427 Workarounds for https://github.com/ytdl... — committed to yt-dlp/yt-dlp by coletdjnz 3 years ago
- [youtube] Add `html5=1` param to `get_video_info` page requests (#329) Workaround for #319, https://github.com/ytdl-org/youtube-dl/issues/29086 Authored by: colethedj — committed to nixxo/yt-dlp by coletdjnz 3 years ago
- [youtube] Temporary fix for age-gate Related: https://stackoverflow.com/a/67629882 https://github.com/yt-dlp/yt-dlp/issues/319 https://github.com/ytdl-org/youtube-dl/issues/29333 https://github.com/y... — committed to nixxo/yt-dlp by pukkandan 3 years ago
- [youtube] Use new API for additional video extraction requests (#328) Co-authored-by: colethedj, pukkandan Closes https://github.com/yt-dlp/yt-dlp/issues/427 Workarounds for https://github.com/ytdl... — committed to nixxo/yt-dlp by coletdjnz 3 years ago
- [youtube] Fix get_video_info request (closes #29086, closes #29165) — committed to LRSnowX/youtube-dl by dstftw 3 years ago
@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-864117168This 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 thatTVHTML5
&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:
@rjdg14 Not all age-gated videos are non-embeddable. See https://github.com/yt-dlp/yt-dlp/pull/328#issuecomment-864117168
Also, see https://github.com/ytdl-org/youtube-dl/issues/29333#issuecomment-864049544 for another workaround
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).
@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?