youtube-dl usage
Last update
2024-06-22
2024-06-22
« — »
build and usage
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 17 18 19 | # 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> # download a portion (-ss=skip duration, -t=process time) youtube-dl <url> --postprocessor-args '-ss 00:00:14 -t 00:04:03' |
format selection
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | yt-dlp -F url # show available formats with their ID # download and join yt-dlp -f "IDvideo+IDaudio" --merge-output-format mkv \ --write-subs --write-auto-subs --sub-format srt \ url # or download separated, then join manually via mkvtoolnix-gui yt-dlp -f "IDvideo,IDaudio" \ --write-subs --write-auto-subs --sub-format srt \ url # optioanl: convert VTT to SRT ffmpeg -i input.vtt output.srt |
download splitted playlist via album_splitter
1 | ./album_splitter.sh URL <video_url> |
browser tools
1 2 3 4 5 6 7 8 9 | // get youtube page links var list = ''; document. querySelectorAll('a[id="video-title"]'). forEach(function (i) { list += 'https://www.youtube.com' + i.getAttribute('href') + ' # ' + i.innerText.trim() + "\n"; }); console.log(list); |
Source: youtube-dl hp, stackoverflow.com, askubuntu.com
See also: yt-dlp fork