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 YouTube.com, 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.txt [YouTube URL]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.