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:
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 for youtube-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.
43 Answers
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 -o /usr/local/bin/yt-dlp sudo chmod a+rx /usr/local/bin/yt-dlpsudo wget -O /usr/local/bin/yt-dlp sudo chmod a+rx /usr/local/bin/yt-dlpsudo aria2c -o /usr/local/bin/yt-dlp sudo chmod a+rx /usr/local/bin/yt-dlp
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 \ "" --verboseMake sure to do the following first:
- Ensure the
python3is 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).
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, . 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.