youtube-dl 视频下载神器

zeo 2020年08月20日 188次浏览




To install it right away for all UNIX users (Linux, macOS, etc.), type:

sudo curl -L -o /usr/local/bin/youtube-dl

我在这一步有一个证书的错误,加-k解决 sudo curl -k -L -o /usr/local/bin/youtube-dl

sudo chmod a+rx /usr/local/bin/youtube-dl
If you do not have curl, you can alternatively use a recent wget:

sudo wget -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
Windows users can download an .exe file and place it in any location on their PATH except for %SYSTEMROOT%\System32 (e.g. do not put in C:\Windows\System32).

You can also use pip:

sudo -H pip install --upgrade youtube-dl
This command will update youtube-dl if you have already installed it. See the pypi page for more information.

macOS users can install youtube-dl with Homebrew:

brew install youtube-dl
Or with MacPorts:

sudo port install youtube-dl
Alternatively, refer to the developer instructions for how to check out and work with the git repository. For further options, including PGP signatures, see the youtube-dl Download Page.


$ youtube-dl --get-filename -o '%(title)s.%(ext)s' BaW_jenozKc
youtube-dl test video ''_ä↭𝕐.mp4    # All kinds of weird characters

$ youtube-dl --get-filename -o '%(title)s.%(ext)s' BaW_jenozKc --restrict-filenames
youtube-dl_test_video_.mp4          # A simple file name

# Download YouTube playlist videos in separate directory indexed by video order in a playlist
$ youtube-dl -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s'

# Download all playlists of YouTube channel/user keeping each playlist in separate directory:
$ youtube-dl -o '%(uploader)s/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s'

# Download Udemy course keeping each chapter in separate directory under MyVideos directory in your home
$ youtube-dl -u user -p password -o '~/MyVideos/%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s'

# Download entire series season keeping each series and each season in separate directory under C:/MyVideos
$ youtube-dl -o "C:/MyVideos/%(series)s/%(season_number)s - %(season)s/%(episode_number)s - %(episode)s.%(ext)s"

# Stream the video being downloaded to stdout
$ youtube-dl -o - BaW_jenozKc

# 走代理
--proxy socks5:// 

# 断点续传

# 比如
youtube-dl --continue  --proxy socks5:// -o  '%(uploader)s/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s'