-
-
Save robertdigital/dff89dee1aa170e985b7d44c67fe4aad to your computer and use it in GitHub Desktop.
Revisions
-
zamnuts created this gist
Nov 27, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ #!/usr/bin/env zsh playlistUrl="$1"; numParallelDownloads="${2:-5}"; numParallelFragments="${3:-5}"; [[ -z "$playlistUrl" ]] && echo 'i need a url to a yt playlist please.' >&2 && exit 1; [[ "$numParallelDownloads" =~ '^[^0-9]+$' ]] && echo "expected parameter 2 to be the number of parallel downloads, got '$numParallelDownloads'." >&2 && exit 1; [[ "$numParallelFragments" =~ '^[^0-9]+$' ]] && echo "expected parameter 3 to be the number of parallel fragments, got '$numParallelFragments'." >&2 && exit 1; echo "Reading playlist, this could take a while depending on the number of items..."; echo "URL: $playlistUrl"; echo "Num Parallel Downloads: $numParallelDownloads"; echo "Num Parallel Fragments: $numParallelFragments"; echo ; yt-dlp \ --yes-playlist \ --skip-download \ --quiet \ --print '%(id)s' \ "$playlistUrl" \ | xargs \ -I '{}' \ -P "$numParallelDownloads" \ yt-dlp \ --newline \ --embed-metadata \ --write-subs \ --convert-subs srt \ --concurrent-fragments "$numParallelFragments" \ --format 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b' \ '{}';