Download video from YouTube (youtube-dl)

This method is fairly stable in downloading videos. This is recommended rather than struggling with the video download service.

Since it operates on the command line, it is relatively easy to incorporate it as a function of the program.

What is youtube-dl

youtube-dl is a ** command line ** program for downloading videos from YouTube.com and other sites.

Requires Python interpreter, versions 2.6, 2.7, 3.2+, platform independent. It works on Unix, Windows and macOS. It's in the public domain, so you can modify it, redistribute it, and use it however you like.

How to use youtube-dl

Used on the command line.

Format


youtube-dl [OPTIONS]YouTube video URL[URL...]

Example of use


$ youtube-dl https://www.youtube.com/watch?v=7wfUUZvybPY
[youtube] 7wfUUZvybPY: Downloading webpage
[download] Destination: How to Install YouTube-DL (Windows 10)-7wfUUZvybPY.mp4
[download] 100% of 14.28MiB in 00:09

Main options

option Description
-u, --username USERNAME YouTube account
-p, --password PASSWORD Account password. Enter interactively if omitted
-o, --output TEMPLATE Output file name template
-s, --simulate Just simulate, not actually download
-t, --title Set the output file name to the video title
-g, --get-url Display download URL

update

Youtube-dl may not be usable if there is a change in YouTube. In that case, there is a mechanism to update.

youtube-Function of dl


sudo youtube-dl -U

If the above doesn't work, you can download, re-install, and update Homebrew and pip on Windows by:

For Homebrew


brew update
brew upgrade youtube-dl

For pip


sudo pip install youtube_dl -U

Installation

Windows Windows users should download the .exe file (https://yt-dl.org/latest/youtube-dl.exe) and use it through PATH.

Mac You can install it with Homebrew.

brew install youtube-dl

Alternatively, you can install it with MacPorts.

sudo port install youtube-dl

pip You can also use pip. https://pypi.org/project/youtube_dl/

sudo -H pip install --upgrade youtube_dl

Linux, MacOS, UNIX

When using curl

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

When using wget

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

that's all

Recommended Posts

Download video from YouTube (youtube-dl)
youtube download memo
How to download youtube videos with youtube-dl
[Python] Extract the video ID from the YouTube video URL [Note]
Download the top 10 views from one Youtube channel at once
Download images from "Irasutoya" using Scrapy
OpenMPI installation from download to pass-through