dotfiles/.bin/ytdl
2025-08-31 19:39:39 +02:00

27 lines
591 B
Bash
Executable File

#!/bin/sh -e
if [ -z $2 ]
then
echo "First argument should be a category."
exit 2
fi
if [ ! -d "$HOME/ytdl/$1/" ]
then
mkdir -p "$HOME/ytdl/$1/"
update-ksh-completions
. $HOME/.kshrc.autocomplete
fi
cd "$HOME/ytdl/$1/"
shift
yt-dlp \
--cookies-from-browser firefox \
--user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0" \
--preset-alias mp4 \
--embed-metadata \
--embed-subs \
--sub-langs "en.*" \
--write-auto-subs \
--restrict-filenames \
-o "%(uploader)s/%(playlist)s/%(title)s.%(ext)s" \
"$@"