I’m sure some of you already using it like this but if not, this could be useful for you.
It creates a directory with the channel’s name, create sub-directories with the playlist name, it gives them a number and put them in an order, it can continue to download if you have to cancel it midway.
You can modify it to your needs.
Add this to your ~/.bashrc
or your favourite shell config.
alias yt='yt-dlp --yes-playlist --no-overwrites --download-archive ~/Downloads/yt-dlp/archive.txt -f "bestvideo[height<=1080]+bestaudio/best[height<=1080]" -o "~/Downloads/yt-dlp/%(uploader)s/%(playlist_title,single_playlist)s/%(playlist_index,00)s - %(title)s - [%(id)s].%(ext)s"'
You can even limit the download speed by adding this parameter: --limit-rate 640K
This example is for 5 Mb/s.
I do something very similar. Thanks for sharing cause there’s always something to learn by seeing how someone else solved a problem. I’ll share mine here too if that’s cool:
#!/usr/bin/env bash music() { case $(uname -s) in Darwin) yt-dlp --format bestaudio --extract-audio --audio-format mp3 \ --postprocessor-args "-strict experimental" "$1" ;; Linux) yt-dlp --format bestaudio --extract-audio --audio-format mp3 "$1" ;; esac } video() { yt-dlp \ --format "bestvideo+bestaudio[ext=m4a]/bestvideo+bestaudio/best" \ --merge-output-format mp4 \ -o "%(title)s.%(ext)s" "$1" } while getopts ':hm:v:' flag; do case "$flag" in h) echo "Usage: youtube [-m(usic) <url> | -v(ideo) <url>]" ; exit 0 ;; m) music "$OPTARG" ;; v) video "$OPTARG" ;; *) echo "Invalid argument." >&2 ; exit 1 ;; esac done
It’s totally cool! I like to see others’ scripts. I agree, there is always something new to learn. I also liked how human readable is this. Thanks for sharing.