As promised here is the bash script.
Code:
#! /usr/bin/env bash
# depends on: aria2, yt-dlp
a2() {
BASE_YTDL=(
"--geo-bypass"
"--no-cache-dir"
"--no-call-home"
"--restrict-filenames"
)
BASE_AR2C="\
--no-netrc=true \
--log-level=error \
--summary-interval=0 \
--auto-save-interval=0 \
--file-allocation=falloc \
--console-log-level=error \
--split=16 \
--min-split-size=1M \
--http-no-cache=true \
--max-connection-per-server=16 \
--max-overall-download-limit=6M \
"
TYPE="$1"
shift
case $TYPE in
aud)
mkdir -p "${HOME}/Music"
(cd "${HOME}/Music" && exec yt-dlp "${BASE_YTDL[@]}" \
--external-downloader aria2c \
--external-downloader-args aria2c:"$(echo -e "$BASE_AR2C")" \
-o '%(title)s.%(ext)s' \
-f 'bestaudio/best' \
--no-playlist \
"$@")
;;
alb)
mkdir -p "${HOME}/Music"
(cd "${HOME}/Music" && exec yt-dlp "${BASE_YTDL[@]}" \
--external-downloader aria2c \
--external-downloader-args aria2c:"$(echo -e "$BASE_AR2C")" \
-o '%(playlist_title)s/%(autonumber)s-%(title)s.%(ext)s' \
-f 'bestaudio/best' \
--yes-playlist \
"$@")
;;
vid)
local QUA='bestvideo[height<=1440]+bestaudio/best[height<=1440]/best'
mkdir -p "${HOME}/Movies"
(
cd "${HOME}/Movies" && exec yt-dlp "${BASE_YTDL[@]}" \
--external-downloader aria2c \
--external-downloader-args aria2c:"$(echo -e "$BASE_AR2C")" \
--sub-langs "en.*" \
--write-subs \
--no-playlist \
-o "%(upload_date)s_%(title)s-[%(id)s].%(ext)s" \
-f "$QUA" \
"$@"
)
;;
*)
echo "Options: aud, alb, vid"
return
;;
esac
}
opt="$1"
shift
for link in "$@"; do
a2 "$opt" "$link"
done
I have it in PATH and use it most of the time to download albums off youtube that are playable as playlists on normal youtube. For videos be sure to change "1440" and yt-dlp options to what you actually want on your machine.
Ideally this should be converted to python since it doesn't really need bash and this way it would also work on Windows but my python experience is just some scripts I needed to do for work and never got around to it.
Bookmarks