Downloading Age Restricted Videos With Youtube-DL

Recently I wanted to download a YouTube video using YouTube-DL, but received the following error message:

WARNING: Unable to download video info webpage: HTTP Error 410: Gone
ERROR: Sign in to confirm your age
This video may be inappropriate for some users.

Although I disagree strongly with YouTube’s increasing habit of haphazardly applying age restrictions on videos, I still wanted a local copy of the video.

The solution is to pass a cookie to YouTube as part of the download process in YouTube-DL. I was able to accomplish that with the following steps.

  1. I installed the Get Cookies extension in Chrome. This extension allows users to export cookies for a site as a text file.
  2. I then visited, while I was logged in, and clicked on the Get
    Cookies icon. Then I clicked on the “Export” button to download my YouTube cookies as a text file.
  3. This created a youtube.com_cookies.txt file that I then copied into the YouTube-DL directory on my laptop.
  4. Finally I ran the following command in YouTube-DL to pass the cookie to YouTube and download the video:
youtube-dl -f bestvideo+bestaudio --merge-output-format mkv --all-subs --cookies youtube.com_cookies.txt [YouTube URL]

6 thoughts on “Downloading Age Restricted Videos With Youtube-DL”

  1. For those still unable to make it work because of the AttributeError: 'bool' object has no attribute 'split' error you can also try 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 "" --verbose

    Make sure the python3 command is working first. Also make sure that the path to your cookies file is correct.

  2. Worked perfectly. Get Cookies saves the file in your Download folder and if you copy paste the youtube-dl command you have to add “.\” in front and edit the cookie file name.

  3. Make sure the filename is correct. The example above isn’t. Works with “youtube.com_cookies.txt”

Leave a Reply