youtube-dl usage
mouse 640 · person cloud · link
Last update
2020-07-22
2020
07-22
« — »
1
2
3
4
5
6
7
# download/upgrade
curl -L -o ~/bin/youtube-dl https://yt-dl.org/downloads/latest/youtube-dl

# build from source repo
git clone https://github.com/ytdl-org/youtube-dl.git
cd youtube-dl
make clean && make
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# to parse a playlist use "--yes-playlist url" or simply "playlist_id"

# downoload a playlist audio only
youtube-dl -i -o "%(title)s.%(ext)s" \
  -f bestaudio --extract-audio --audio-format mp3 --audio-quality 5 \
  --postprocessor-args "-ar 44100" \
  <playlist_id>

# extract audio tracks from an url list
cat list.txt | xargs youtube-dl -i -o "%(title)s.%(ext)s" \
  -f bestaudio --extract-audio --audio-format mp3 --audio-quality 5
  --postprocessor-args "-ar 44100"

# download a specific combination of audio and video in a single file
youtube-dl -F <url> # detect desired format codes
youtube-dl --merge-output-format mkv -f <code1>+<code2> <url>

Source: youtube-dl hp, stackoverflow.com, askubuntu.com