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]

14 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”

  4. This works perfectly. For those who don’t get it to work, please try and add quotation marks to the YouTube URL, namely ‘’. I need quotation marks to get this working in iTerm. Also, just drag the cookie file to the terminal window and your will get the full path.. but that’s just plain good practice doing anything with the terminal on a Mac..

  5. I can’t make this work. I exported the cookie while on the YouTube page and signed in. I used the –cookies option to give it the cookie file and it still gives me the same error about it being age restricted.

  6. I can get this to work with an individual URL (i.e. entering the URL as part of the youtube-dl command), but not with a batch file of URLs. When I run it with a batch file, I simply get the same age-restricted error. I tried adding the —cookies option to the YouTube-dl config file, but that didn’t change anything. Do you know of any way to get it to work with a batch file?

  7. Thank you! This worked perfectly. To those having trouble, make sure the youtube.com_cookies.text file is in the same directory file you currently have selected for youtube-dl (mine goes right to my desktop, then I move afterward).

Leave a Reply