misc-scripts/twitch-vodarchive

26 lines
538 B
Bash
Executable File

#!/bin/sh
set -euf
while getopts :vcq: OPT; do
case "$OPT" in
v) novod=1 ;;
c) nochat=1 ;;
q) quality=$OPTARG ;;
*) exit 1 ;;
esac
done
shift $((OPTIND - 1))
for url; do
filename="$(yt-dlp -O '%(upload_date>%Y-%m-%d)s %(title)s.%(ext)s' "$url" | sed 's/\//_/g')"
if [ -z "${novod:-}" ]; then
yt-dlp ${quality:+-f "$quality"} -o "$filename" "$url"
fi
if [ -z "${nochat:-}" ]; then
for ext in json html txt; do
twitchdownloader chatdownload -o "${filename%.*}.$ext" -u "$url"
done
fi
done