vodarchive: better

This commit is contained in:
yosh 2024-01-25 00:44:48 -05:00
parent 93092ab241
commit fb8998656c
1 changed files with 21 additions and 5 deletions

View File

@ -1,9 +1,25 @@
#!/bin/sh
set -euf
filename="$(yt-dlp -O '%(upload_date>%Y-%m-%d)s %(title)s.%(ext)s' "$1")"
yt-dlp -o "$filename" "$1"
for ext in json html txt; do
twitchdownloader chatdownload -o "${filename%.*}.$ext" -u "$1"
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")"
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