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]

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

    1. I figured out how to get it working. It’s similar to an explanation given by the user named “Dude,” but not completely similar.
      First, you need to get an addon / extension /plugin (whatever you choose to call it) for your browser, that can extract and export the cookies for the site you’re taking the video from. There’s one on “the Web Store” simply called “Get Cookies,” which works fine.

      Using “Get Cookies” is simple; once you’re at the video site, open the Get Cookies menu in your browswer, and press its “Export” button.
      Then, when you’re choosing where the resulting txt file will get exported to, make sure the file directory doesn’t have any spaces. (Important, because youtube-dl reads spaces as indicating a new command or a new input variable.)
      When you’re ready to download the video, input the command –cookies, followed by a space, followed by the file directory of the cookies txt file. For example: –cookies C:\Windows\Web\youtube.com_cookies.txt
      Then, make another empty space, and copy-paste the address of the video you want.
      So for example, a whole command would look like: youtube-dl –cookies C:\Windows\Web\youtube.com_cookies.txt

  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).

  8. May I ask for some help please. Long ago I got YTdl to work and even made a simple ‘download.bat’ file and it works fine except with this age-restricted video.

    Here’s what’s in my ‘download.bat’ file, which I got from a YT video long ago:

    @echo off
    echo Input link to video you want downloaded.
    set /p video=:
    youtube-dl.exe -f mp4 %video%


    I have exported the cookies txt file as explained above to the same folder as where the YTdl batch file is and even moved the whole folder to make sure there were no spaces in the path.

    How can I change my batch file or make a new batch file for these age-restricted videos?

    I have a feeling the YT may start doing more of this, this is my first experience with the age restricted thing.

    Thanks in advance.

    1. I think I figured out how to change my batch file and it worked.

      This is my age restricted batch file now:

      @echo off
      echo Input link to video you want downloaded.
      set /p video=:
      youtube-dl.exe -f mp4 %video% –merge-output-format mkv –cookies youtube.com_cookies.txt


      Sorry to sound so dense, but I’m old school and have not kept up on this stuff. I was shocked that I still had some memory cells about DOS still hanging around.

        1. Thank you for the reply. Alas, my machine isn’t 64 bit. Like I said I am old skool and apparently so is my machine. I might have to do something about that some day soon.

Leave a Reply