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

RIAA Uses DMCA To Take Down YouTube-DL Repositories on GitHub

On October 23rd, the RIAA used a DMCA letter to takedown the YouTube-DL GitHub repository, along with a couple of dozen forks of the project. As of Friday, 10/23/2020, many of those repositories returned the following message.

Repository unavailable due to DMCA takedown.

This repository is currently disabled due to a DMCA takedown notice. We have disabled public access to the repository. The notice has been publicly posted.

If you are the repository owner, and you believe that your repository was disabled as a result of mistake or misidentification, you have the right to file a counter notice and have the repository reinstated. Our help articles provide more details on our DMCA takedown policy and how to file a counter notice. If you have any questions about the process or the risks in filing a counter notice, we suggest that you consult with a lawyer.

GitHub posted the RIAA’s takedown request letter in its DMCA repository. The letter reads in part,

I am contacting you on behalf of the Recording Industry Association of America, Inc. (RIAA) and its member record companies. The RIAA is a trade association whose member companies create, manufacture or distribute sound recordings representing approximately eighty-five (85) percent of all legitimate recorded music consumption in the United States. Under penalty of perjury, we submit that the RIAA is authorized to act on behalf of its member companies on matters involving the infringement of their sound recordings, audiovisual works and images, including enforcing their copyrights and common law rights on the Internet.

Copyright Violations. We have learned that your service is hosting the youtube-dl source code on its network at the following locations, among others:

. . .

The clear purpose of this source code is to (i) circumvent the technological protection measures used by authorized streaming services such as YouTube, and (ii) reproduce and distribute music videos and sound recordings owned by our member companies without authorization for such use. We note that the source code is described on GitHub as “a command-line program to download videos from YouTube.com and a few more sites.”

We also note that the source code prominently includes as sample uses of the source code the downloading of copies of our members’ copyrighted sound recordings and music videos, as noted in Exhibit A hereto. For example, as shown on Exhibit A, the source code expressly suggests its use to copy and/or distribute the following copyrighted works owned by our member companies:

• Icona Pop – I Love It (feat. Charli XCX) [Official Video], owned by Warner Music Group
• Justin Timberlake – Tunnel Vision (Explicit), owned by Sony Music Group
• Taylor Swift – Shake it Off, owned/exclusively licensed by Universal Music Group

Use Youtube-DL to Download a List of Video URLs in a Text File

Recently I needed to download a large number of YouTube videos using youtube-dl. I had a list of URLs, added those to a text file that I creatively called list.txt, and then put that file in my youtube-dl directory.

The following command then downloaded all the videos in that file.

$ youtube-dl -f bestvideo+bestaudio --merge-output-format mkv --all-subs -a list.txt

Downloading YouTube Videos With YouTube-DL + FFmpeg

YouTube-DL is an open source, command-line program to download videos from YouTube. The GitHub repository contains a downloadable Windows executable.

FFmpeg is an open source “cross-platform solution to record, convert and stream audio and video.” A Windows executable version of FFmpeg can be downloaded from FFmpeg Builds.

I am primarily a Windows user, so I create a /youtube-dl/ subdirectory in my /downloads/ directory.

Then I put the YouTube-DL and FFmpeg executables in that directory.

To download the highest quality version of a YouTube video, I run CMD, navigation to the /downloads/youtube-dl/ directory, and use this:

> youtube-dl -f bestvideo+bestaudio --merge-output-format mkv [YouTube URL]

If the [YouTube URL] is a link to a YouTube playlist, YouTube-dl will helpfully download the entire playlist.