How do I enable youtube-dl to bypass the age restriction on YouTube?
Solution 1
yt-dlp looks like a fork of youtube-dl
and works as expected. You can install it as follows (from the project's GitHub page):
UNIX users (GNU/Linux, macOS, BSD) can also install the latest release one of the following ways:
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp sudo chmod a+rx /usr/local/bin/yt-dlp
sudo wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp sudo chmod a+rx /usr/local/bin/yt-dlp
sudo aria2c https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp sudo chmod a+rx /usr/local/bin/yt-dlp
Solution 2
There is a workaround, but not exactly by using youtube-dl
. Currently the best method to access Youtube's age-restricted videos (without logging in) is to use the Invidious network, which provides an alternate method of accessing Youtube's video content. For example you can use the main site of Invidious network, https://yewtu.be/ . Invidious network sites provide a download option under each video.
There is also an application called FreeTube that allows to view and download Youtube videos. It can automatically use Invidious servers in case it can't download the video from Youtube directly.
Solution 3
You can try this workaround using Python 3.x with the following command (I've added the --verbose
flag in case of debugging):
python3 /usr/local/bin/youtube-dl -f bestvideo+bestaudio \
--all-subs --cookies $PWD/youtube.com_cookies.txt \
"https://www.youtube.com/watch?v=VIDEO_ID_HERE" --verbose
Make sure to do the following first:
- Ensure the
python3
is installed, that the command is working, and that it actually runs a version of Python 3.x. - Make sure that the path to your cookies file is correct.
- Make sure that you have the latest version of youtube-dl installed (
youtube-dl --version
). - Ensure the absolute file path for the youtube-dl binary or installation (In a UNIX-like terminal use
which youtube-dl
).
Related videos on Youtube
Allan
Updated on September 18, 2022Comments
-
Allan almost 2 years
I tried downloading a particular YouTube video using
youtube-dl
(in terminal) and got the following display:[youtube] 8_Ik8elX96w: Downloading webpage [youtube] 8_Ik8elX96w: Downloading embed webpage [youtube] 8_Ik8elX96w: Refetching age-gated info webpage ERROR: This video may be inappropriate for some users.
The URL for the video is: https://www.youtube.com/watch?v=8_Ik8elX96w
I've been told that this is to do with YouTube age restrictions and that I need
youtube-dl
to log in to my YouTube account to bypass the restriction; and this requires can be enabled by supplying the required cookie set for YouTube log-in in the command line. (youtube-dl
does not access YouTube via my browser, so manually logging in through my browser does not bypass the restriction foryoutube-dl
.)If this is the correct way to bypass the restriction, please tell me how to find the cookie path to type into the command line and the procedure for entering it there. I am using Firefox; apparently the method of finding the required cookie text is different for each browser.
-
Admin about 3 yearsDoes this answer your question? Why is youtube-dl blocking me from downloading YouTube videos which are supposedly "innappropriate for some users"?
-
Admin about 3 yearsDon't ask the same question twice.
-
Admin about 3 years@heynnema The first question about was why it is happening. I also asked whether there is a work around, in the body of that question. This question is asking what the work-around is and how I do it. Nobody gave me specific instructions for this in response to the first question. So no, there is no answer posted for this to the first question. Did you bother to read it before wisecracking?
-
Admin about 3 yearsBoth questions are about a third-party program not supplied by Ubuntu, and a third-party YouTube video, also having nothing to do with Ubuntu. Both questions are actually off-topic on this web site. Do
youtube-dl -h
for more help.
-
-
reim over 2 yearsWith
youtube-dl
version2021.12.17
the--cookies
option works indeed, you can export all of of your YouTube cookies in Netscape format with this chrome.google.com/webstore/detail/get-cookiestxt/… Chrome extension (make sure you run it on the tab where you have a logged in YouTube page).