Update aliases with some audio transcription stuff
This commit is contained in:
parent
e5e8f309e5
commit
ce1599466e
518
aliases
518
aliases
|
@ -313,9 +313,13 @@ alias grep-dev='grep_dev'
|
|||
|
||||
COMPRESSION_ON=1
|
||||
COMPRESSION_OFF=0
|
||||
|
||||
SHORTNAME_ON=1
|
||||
SHORTNAME_OFF=0
|
||||
|
||||
TRANSCRIBE_ON=1
|
||||
TRANSCRIBE_OFF=0
|
||||
|
||||
make_vid_dir_and_cd_into() {
|
||||
local url="$1"
|
||||
local dir_name="$2"
|
||||
|
@ -346,13 +350,20 @@ make_vid_dir_and_cd_into() {
|
|||
return 0
|
||||
}
|
||||
|
||||
transcribe_vid() {
|
||||
name_without_ext="${1%.*}"
|
||||
transcribe-video "$1" "$name_without_ext" base small
|
||||
}
|
||||
|
||||
# Download YouTube videos. Note that yt-dlp downloads a lot faster than streamlink.
|
||||
download_youtube_vid() {
|
||||
local format="$1"
|
||||
local shortname="$2"
|
||||
local make_folder="$3"
|
||||
local url="$4"
|
||||
shift 4
|
||||
local transcribe="$3"
|
||||
|
||||
local make_folder="$4"
|
||||
local url="$5"
|
||||
shift 5
|
||||
local opts="$@"
|
||||
|
||||
if [[ $url == "" ]]; then
|
||||
|
@ -360,59 +371,23 @@ download_youtube_vid() {
|
|||
return
|
||||
fi
|
||||
|
||||
if [[ $format == "" ]]; then
|
||||
printf "${BOLD}No format given; using best available.${NORMAL}\n"
|
||||
# Download best mp4 video and best m4a audio, then merge.
|
||||
format="bv*[ext=mp4]+ba[ext=m4a]"
|
||||
opts+=" --merge-output-format mp4"
|
||||
fi
|
||||
|
||||
opts+=" --write-subs --sub-lang en --embed-subs"
|
||||
|
||||
if [[ $make_folder == "1" ]]; then
|
||||
make_vid_dir_and_cd_into $url ""
|
||||
if [[ $? -ne 0 ]]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $shortname -eq 0 ]]; then
|
||||
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-yt-%(id)s.%(ext)s"
|
||||
if [[ $shortname == "1" || $transcribe == "1" ]]; then
|
||||
printf "${BOLD}Downloading Youtube vid "
|
||||
if [[ $shortname == "1" ]]; then printf "| ${YELLOW}using short name${NORMAL}${BOLD} "; fi
|
||||
if [[ $transcribe == "1" ]]; then printf "| ${YELLOW}audio transcription on${NORMAL}${BOLD} "; fi
|
||||
printf "\n\n${NORMAL}"
|
||||
else
|
||||
local name_format="%(upload_date>%Y-%m-%d)s-shortname-yt-%(id)s.%(ext)s"
|
||||
printf "${BOLD}Downloading Youtube vid\n\n${NORMAL}"
|
||||
fi
|
||||
|
||||
local cmd="yt-dlp.exe -f $format -o \"$name_format\" $opts $url"
|
||||
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
|
||||
|
||||
# Removing any trailing subtitle files
|
||||
rm *.vtt *.srt 2>/dev/null
|
||||
|
||||
if [[ $make_folder == "1" ]]; then
|
||||
cd ..
|
||||
fi
|
||||
}
|
||||
|
||||
# Download YouTube video and flip horizontally.
|
||||
download_youtube_vid_and_hflip() {
|
||||
local format="$1"
|
||||
local make_folder="$2"
|
||||
local url="$3"
|
||||
shift 3
|
||||
local opts="$@"
|
||||
|
||||
if [[ $url == "" ]]; then
|
||||
error "Usage: $0 <make folder?> <url> <optional args>"
|
||||
return
|
||||
fi
|
||||
if [[ $format == "" ]]; then
|
||||
printf "${BOLD}No format given; using best available.${NORMAL}\n"
|
||||
# Download best mp4 video and best m4a audio, then merge.
|
||||
# Download best mp4 video.
|
||||
format="bv*[ext=mp4]+ba[ext=m4a]"
|
||||
opts+=" --merge-output-format mp4"
|
||||
fi
|
||||
|
||||
opts+=" --write-sub --sub-lang en --embed-subs"
|
||||
# We're assuming we'll always have an mp4 video only and audio track to merge.
|
||||
opts+=" --merge-output-format mp4 --write-subs --sub-lang en --embed-subs"
|
||||
|
||||
if [[ $make_folder == "1" ]]; then
|
||||
make_vid_dir_and_cd_into $url ""
|
||||
|
@ -421,21 +396,35 @@ download_youtube_vid_and_hflip() {
|
|||
fi
|
||||
fi
|
||||
|
||||
local filename=$(yt-dlp.exe --get-filename -f $format -o "%(upload_date>%Y-%m-%d)s-%(title)s-yt-%(id)s.%(ext)s" $url)
|
||||
if [[ $shortname == "0" ]]; then
|
||||
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-yt-%(id)s"
|
||||
else
|
||||
local name_format="%(upload_date>%Y-%m-%d)s-shortname-yt-%(id)s"
|
||||
fi
|
||||
|
||||
# Get the video filename.
|
||||
local filename=$(yt-dlp.exe --get-filename -f $format -o "$name_format.%(ext)s" $opts $url)
|
||||
printf "filename: $filename\n"
|
||||
|
||||
# Download
|
||||
local cmd="yt-dlp.exe -f $format -o \"$filename\" $opts $url"
|
||||
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
|
||||
error=$?
|
||||
|
||||
if [[ $error -ne 0 ]]; then
|
||||
error "Error: Failed to download '$url'"
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Removing any trailing subtitle files
|
||||
rm *.vtt *.srt 2>/dev/null
|
||||
|
||||
# Flip
|
||||
ffmpeg -i "$filename" -vf hflip -c:a copy "copy_${filename}"
|
||||
mv "copy_${filename}" "$filename"
|
||||
|
||||
if [[ $make_folder == "1" ]]; then
|
||||
cd ..
|
||||
if [[ $transcribe == "1" ]]; then
|
||||
transcribe_vid "$filename"
|
||||
fi
|
||||
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
}
|
||||
|
||||
download_youtube_playlist() {
|
||||
|
@ -449,6 +438,9 @@ download_youtube_playlist() {
|
|||
error "Usage: $0 <url> <directory name (optional)> <optional args>"
|
||||
return
|
||||
fi
|
||||
|
||||
printf "${BOLD}Downloading Youtube playlist\n\n${NORMAL}"
|
||||
|
||||
if [[ $format == "" ]]; then
|
||||
printf "${BOLD}No format given; using best available.${NORMAL}\n"
|
||||
# Download best mp4 video and best m4a audio, then merge.
|
||||
|
@ -486,6 +478,7 @@ actually_download_twitch_chat() {
|
|||
else
|
||||
error "Video doesn't have a chat transcript."
|
||||
fi
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
download_twitch_chat() {
|
||||
|
@ -513,102 +506,6 @@ download_twitch_chat() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Copy pasta of download_twitch_vid with a final pass to transcribe the audio using whisper.cpp
|
||||
download_twitch_vid_and_transcribe() {
|
||||
local format="$1"
|
||||
local shortname="$2"
|
||||
local compress="$3"
|
||||
local make_folder="$4"
|
||||
local url="$5"
|
||||
shift 5
|
||||
local opts="$@"
|
||||
|
||||
if [[ $url == "" ]]; then
|
||||
error "Usage: $0 <make folder?> <url> <optional args>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We use yt-dlp to get the filename and then use streamlink to download it (the latter is a lot faster).
|
||||
# It's a two step process because streamlink cannot pass the formatted filename to ffmpeg.
|
||||
# We fallback to yt-dlp when it's a subscriber VOD because we don't have an easy way to access it with streamlink.
|
||||
|
||||
local subscriber_vod=0
|
||||
local split_opts=($opts)
|
||||
if [[ ${split_opts[0]} == "--cookies" ]]; then
|
||||
subscriber_vod=1
|
||||
printf "${BOLD}Subscriber VOD. Will use yt-dlp to download.${NORMAL}\n"
|
||||
fi
|
||||
|
||||
if [[ $compress -eq 0 ]]; then
|
||||
printf "${BOLD}Downloading Twitch vid with no compression.${NORMAL}\n"
|
||||
else
|
||||
printf "${BOLD}Downloading Twitch vid with compression.${NORMAL}\n"
|
||||
fi
|
||||
|
||||
local yt_dlp_format=""
|
||||
local streamlink_format=""
|
||||
|
||||
if [[ $format == "" ]]; then
|
||||
# Twitch only supplies pre-merged mp4s so we can ask for the best format and not worry about anything else.
|
||||
printf "${BOLD}No format given; using best available.${NORMAL}\n"
|
||||
yt_dlp_format="b"
|
||||
streamlink_format="best"
|
||||
else
|
||||
yt_dlp_format="$format"
|
||||
streamlink_format="$format"
|
||||
fi
|
||||
|
||||
if [[ $make_folder == "1" ]]; then
|
||||
make_vid_dir_and_cd_into $url "" $opts
|
||||
if [[ $? -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $shortname -eq 0 ]]; then
|
||||
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-tw-%(id)s"
|
||||
else
|
||||
local name_format="%(upload_date>%Y-%m-%d)s-shortname-tw-%(id)s"
|
||||
fi
|
||||
|
||||
# Download Twitch chat transcript
|
||||
actually_download_twitch_chat $url "$(yt-dlp.exe --get-filename -o "$name_format" $opts $url)"
|
||||
|
||||
# Get the video filename.
|
||||
local filename=$(yt-dlp.exe --get-filename -o "$name_format.%(ext)s" $opts $url)
|
||||
|
||||
# Download
|
||||
if [[ $subscriber_vod -eq 0 ]]; then
|
||||
local cmd="streamlink.exe --twitch-low-latency --twitch-disable-ads --twitch-disable-hosting --force --force-progress $opts $url $streamlink_format -O | ffmpeg -i pipe:0 -c copy \"$filename\""
|
||||
else
|
||||
local cmd="yt-dlp.exe -f $yt_dlp_format -o \"$filename\" $opts $url"
|
||||
fi
|
||||
|
||||
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
|
||||
|
||||
error=$?
|
||||
if [[ $error -eq 0 ]]; then
|
||||
if [[ $compress -eq 1 ]]; then
|
||||
local temp_name="temp_${RANDOM}"
|
||||
# 0=cpu, 1=gpu
|
||||
compress-video "$filename" "$temp_name" 0
|
||||
extension="${filename##*.}"
|
||||
mv "$filename" "orig_$filename"
|
||||
mv $temp_name.$extension "$filename"
|
||||
printf "${BOLD}Make sure to delete the original video file${NORMAL}\n"
|
||||
fi
|
||||
else
|
||||
error "Error: Failed to download '$url'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
transcribe-video "$filename" jon base small
|
||||
|
||||
if [[ $make_folder == "1" ]]; then
|
||||
cd ..
|
||||
fi
|
||||
}
|
||||
|
||||
# Download Twitch videos, both VODs and live streams. Pass a Twitch account URL to download a live stream.
|
||||
# The live stream filename will not contain the stream title, so you'll need to modify it afterwards.
|
||||
#
|
||||
|
@ -624,14 +521,15 @@ download_twitch_vid() {
|
|||
local format="$1"
|
||||
local shortname="$2"
|
||||
local compress="$3"
|
||||
local make_folder="$4"
|
||||
local url="$5"
|
||||
shift 5
|
||||
local transcribe="$4"
|
||||
local make_folder="$5"
|
||||
local url="$6"
|
||||
shift 6
|
||||
local opts="$@"
|
||||
|
||||
if [[ $url == "" ]]; then
|
||||
error "Usage: $0 <make folder?> <url> <optional args>"
|
||||
exit 1
|
||||
return
|
||||
fi
|
||||
|
||||
# We use yt-dlp to get the filename and then use streamlink to download it (the latter is a lot faster).
|
||||
|
@ -645,10 +543,14 @@ download_twitch_vid() {
|
|||
printf "${BOLD}Subscriber VOD. Will use yt-dlp to download.${NORMAL}\n"
|
||||
fi
|
||||
|
||||
if [[ $compress -eq 0 ]]; then
|
||||
printf "${BOLD}Downloading Twitch vid with no compression.${NORMAL}\n"
|
||||
if [[ $shortname == "1" || $compress == "1" || $transcribe == "1" ]]; then
|
||||
printf "${BOLD}Downloading Twitch vid "
|
||||
if [[ $shortname == "1" ]]; then printf "| ${YELLOW}using short name${NORMAL}${BOLD} "; fi
|
||||
if [[ $compress == "1" ]]; then printf "| ${YELLOW}compression on${NORMAL}${BOLD} "; fi
|
||||
if [[ $transcribe == "1" ]]; then printf "| ${YELLOW}audio transcription on${NORMAL}${BOLD} "; fi
|
||||
printf "\n\n${NORMAL}"
|
||||
else
|
||||
printf "${BOLD}Downloading Twitch vid with compression.${NORMAL}\n"
|
||||
printf "${BOLD}Downloading Twitch vid\n\n${NORMAL}"
|
||||
fi
|
||||
|
||||
local yt_dlp_format=""
|
||||
|
@ -667,11 +569,11 @@ download_twitch_vid() {
|
|||
if [[ $make_folder == "1" ]]; then
|
||||
make_vid_dir_and_cd_into $url "" $opts
|
||||
if [[ $? -ne 0 ]]; then
|
||||
exit 1
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $shortname -eq 0 ]]; then
|
||||
if [[ $shortname == "0" ]]; then
|
||||
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-tw-%(id)s"
|
||||
else
|
||||
local name_format="%(upload_date>%Y-%m-%d)s-shortname-tw-%(id)s"
|
||||
|
@ -681,60 +583,70 @@ download_twitch_vid() {
|
|||
actually_download_twitch_chat $url "$(yt-dlp.exe --get-filename -o "$name_format" $opts $url)"
|
||||
|
||||
# Get the video filename.
|
||||
local filename=$(yt-dlp.exe --get-filename -o "$name_format.%(ext)s" $opts $url)
|
||||
local filename=$(yt-dlp.exe --get-filename -f $yt_dlp_format -o "$name_format.%(ext)s" $opts $url)
|
||||
|
||||
# Download
|
||||
if [[ $subscriber_vod -eq 0 ]]; then
|
||||
if [[ $subscriber_vod == "0" ]]; then
|
||||
local cmd="streamlink.exe --twitch-low-latency --twitch-disable-ads --twitch-disable-hosting --force --force-progress $opts $url $streamlink_format -O | ffmpeg -i pipe:0 -c copy \"$filename\""
|
||||
else
|
||||
local cmd="yt-dlp.exe -f $yt_dlp_format -o \"$filename\" $opts $url"
|
||||
fi
|
||||
|
||||
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
|
||||
printf "${YELLOW}${BOLD}Downloading video\n${NORMAL}"
|
||||
|
||||
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
|
||||
error=$?
|
||||
if [[ $error -eq 0 ]]; then
|
||||
if [[ $compress -eq 1 ]]; then
|
||||
local temp_name="temp_${RANDOM}"
|
||||
# 0=cpu, 1=gpu
|
||||
compress-video "$filename" "$temp_name" 0
|
||||
extension="${filename##*.}"
|
||||
mv "$filename" "orig_$filename"
|
||||
mv $temp_name.$extension "$filename"
|
||||
printf "${BOLD}Make sure to delete the original video file${NORMAL}\n"
|
||||
fi
|
||||
else
|
||||
|
||||
if [[ $error -ne 0 ]]; then
|
||||
error "Error: Failed to download '$url'"
|
||||
exit 1
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ $make_folder == "1" ]]; then
|
||||
cd ..
|
||||
if [[ $compress == "1" ]]; then
|
||||
local temp_name="temp_${RANDOM}"
|
||||
# 0=cpu, 1=gpu
|
||||
compress-video "$filename" "$temp_name" 0
|
||||
extension="${filename##*.}"
|
||||
mv "$filename" "orig_$filename"
|
||||
mv $temp_name.$extension "$filename"
|
||||
printf "${BOLD}Make sure to delete the original video file\n${NORMAL}"
|
||||
fi
|
||||
|
||||
if [[ $transcribe == "1" ]]; then
|
||||
transcribe_vid "$filename"
|
||||
fi
|
||||
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
}
|
||||
|
||||
# Download Vimeo videos.
|
||||
# Can download an embedded vid. You might need to save the site cookies if the vid is behind a paywall.
|
||||
# e.g. yt-dlp.exe -F --cookies cookies.txt --referer https://gillyandkeeves.tv https://player.vimeo.com/video/756941969
|
||||
# e.g. --cookies cookies.txt --referer https://gillyandkeeves.tv https://player.vimeo.com/video/756941969
|
||||
# The vid ID can be found by looking at the embed's iframe src attribute.
|
||||
download_vimeo_vid() {
|
||||
local format="$1"
|
||||
local shortname="$2"
|
||||
local compress="$3"
|
||||
local make_folder="$4"
|
||||
local url="$5"
|
||||
local shortname="$1"
|
||||
local compress="$2"
|
||||
local transcribe="$3"
|
||||
local format="$4"
|
||||
local make_folder="$5"
|
||||
local url="$6"
|
||||
shift 5
|
||||
local opts="$@"
|
||||
|
||||
if [[ $url == "" ]]; then
|
||||
error "Usage: $0 <make folder?> <url> <optional args>"
|
||||
if [[ $format == "" || $url == "" ]]; then
|
||||
error "Usage: $0 <format> <make folder?> <url> <optional args>"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ $compress -eq 0 ]]; then
|
||||
printf "${BOLD}Downloading Vimeo vid with no compression.${NORMAL}\n"
|
||||
if [[ $shortname == "1" || $compress == "1" || $transcribe == "1" ]]; then
|
||||
printf "${BOLD}Downloading Vimeo vid "
|
||||
if [[ $shortname == "1" ]]; then printf "| ${YELLOW}using short name${NORMAL}${BOLD} "; fi
|
||||
if [[ $compress == "1" ]]; then printf "| ${YELLOW}compression on${NORMAL}${BOLD} "; fi
|
||||
if [[ $transcribe == "1" ]]; then printf "| ${YELLOW}audio transcription on${NORMAL}${BOLD} "; fi
|
||||
printf "\n\n${NORMAL}"
|
||||
else
|
||||
printf "${BOLD}Downloading Vimeo vid with compression.${NORMAL}.\n"
|
||||
printf "${BOLD}Downloading Vimeo vid\n\n${NORMAL}"
|
||||
fi
|
||||
|
||||
if [[ $make_folder == "1" ]]; then
|
||||
|
@ -744,7 +656,7 @@ download_vimeo_vid() {
|
|||
fi
|
||||
fi
|
||||
|
||||
if [[ $shortname -eq 0 ]]; then
|
||||
if [[ $shortname == "0" ]]; then
|
||||
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-vimeo-%(id)s"
|
||||
else
|
||||
local name_format="%(upload_date>%Y-%m-%d)s-shortname-vimeo-%(id)s"
|
||||
|
@ -758,7 +670,7 @@ download_vimeo_vid() {
|
|||
|
||||
error=$?
|
||||
if [[ $error -eq 0 ]]; then
|
||||
if [[ $compress -eq 1 ]]; then
|
||||
if [[ $compress == "1" ]]; then
|
||||
local temp_name="temp_${RANDOM}"
|
||||
# 0=cpu, 1=gpu
|
||||
compress-video "$filename" "$temp_name" 0
|
||||
|
@ -769,11 +681,15 @@ download_vimeo_vid() {
|
|||
fi
|
||||
else
|
||||
error "Error: Failed to download '$url'"
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ $make_folder == "1" ]]; then
|
||||
cd ..
|
||||
if [[ $transcribe == "1" ]]; then
|
||||
transcribe_vid "$filename"
|
||||
fi
|
||||
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
}
|
||||
|
||||
# Download Twitter videos.
|
||||
|
@ -822,9 +738,60 @@ download_twitter_vid() {
|
|||
error "Error: Failed to download '$url'"
|
||||
fi
|
||||
|
||||
if [[ $make_folder == "1" ]]; then
|
||||
cd ..
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
}
|
||||
|
||||
# Download Instagram videos.
|
||||
download_instagram_vid() {
|
||||
local transcribe="$1"
|
||||
|
||||
local make_folder="$2"
|
||||
local url="$3"
|
||||
local vid_name="$4"
|
||||
|
||||
if [[ $url == "" ]]; then
|
||||
error "Usage: $0 <make folder?> <url> <optional filename> <optional args>"
|
||||
return
|
||||
fi
|
||||
|
||||
printf "${BOLD}Downloading Instagram vid.${NORMAL}\n"
|
||||
|
||||
if [[ $vid_name == "" ]]; then
|
||||
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-ig-%(id)s"
|
||||
local opts=""
|
||||
else
|
||||
local name_format="%(upload_date>%Y-%m-%d)s-${vid_name}-ig-%(id)s"
|
||||
shift 4
|
||||
local opts="$@"
|
||||
fi
|
||||
|
||||
if [[ $make_folder == "1" ]]; then
|
||||
make_vid_dir_and_cd_into $url $vid_name $opts
|
||||
if [[ $? -ne 0 ]]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
format="b" # best available
|
||||
|
||||
# Download the video.
|
||||
local filename=$(yt-dlp.exe --get-filename -f $format -o "$name_format.%(ext)s" $opts $url)
|
||||
|
||||
local cmd="yt-dlp.exe -f $format -o \"$filename\" $opts $url"
|
||||
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
|
||||
|
||||
error=$?
|
||||
if [[ $error -eq 1 ]]; then
|
||||
error "Error: Failed to download '$url'"
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ $transcribe == "1" ]]; then
|
||||
transcribe "$filename"
|
||||
fi
|
||||
|
||||
if [[ $make_folder == "1" ]]; then cd ..; fi
|
||||
}
|
||||
|
||||
# Download MP4 video.
|
||||
|
@ -871,94 +838,125 @@ download_from_m3u8() {
|
|||
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
|
||||
}
|
||||
|
||||
# Download Instagram video and flip horizontally.
|
||||
download_instagram_vid_and_hflip() {
|
||||
local url="$1"
|
||||
local filename="$2"
|
||||
|
||||
if [[ $url == "" || $filename == "" ]]; then
|
||||
error "Usage: $0 <url> <filename>"
|
||||
return
|
||||
fi
|
||||
|
||||
temp_name="temp_${RANDOM}.mp4"
|
||||
|
||||
printf "${BOLD}Downloading: ${YELLOW}$filename${NORMAL}\n"
|
||||
curl "$url" -o $temp_name
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
error "Error: failed to download."
|
||||
return
|
||||
fi
|
||||
|
||||
# Flip
|
||||
ffmpeg -i $temp_name -vf hflip -c:a copy "copy_$temp_name"
|
||||
mv copy_${temp_name} "$filename.mp4"
|
||||
rm $temp_name
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
# YouTube Vid DL
|
||||
alias yt='download_youtube_vid "" $SHORTNAME_OFF'
|
||||
alias yt-shortname='download_youtube_vid "" $SHORTNAME_ON'
|
||||
alias yt-1080='download_youtube_vid "137+140" $SHORTNAME_OFF'
|
||||
alias yt-1080-shortname='download_youtube_vid "137+140" $SHORTNAME_ON'
|
||||
alias yt-720='download_youtube_vid "136+140" $SHORTNAME_OFF'
|
||||
alias yt-720-shortname='download_youtube_vid "136+140" $SHORTNAME_ON'
|
||||
|
||||
alias yt-playlist='download_youtube_playlist ""'
|
||||
#-------------------------------------------------
|
||||
alias yt='download_youtube_vid "" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||
alias yt-shortname='download_youtube_vid "" $SHORTNAME_ON $TRANSCRIBE_OFF'
|
||||
alias yt-1080='download_youtube_vid "137+140" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||
alias yt-1080-shortname='download_youtube_vid "137+140" $SHORTNAME_ON $TRANSCRIBE_OFF'
|
||||
alias yt-720='download_youtube_vid "136+140" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||
alias yt-720-shortname='download_youtube_vid "136+140" $SHORTNAME_ON $TRANSCRIBE_OFF'
|
||||
#TRANSCRIPTION ON
|
||||
alias ytt='download_youtube_vid "" $SHORTNAME_OFF $TRANSCRIBE_ON'
|
||||
alias yt-shortname-t='download_youtube_vid "" $SHORTNAME_ON $TRANSCRIBE_ON'
|
||||
alias yt-1080-t='download_youtube_vid "137+140" $SHORTNAME_OFF $TRANSCRIBE_ON'
|
||||
alias yt-1080-shortname-t='download_youtube_vid "137+140" $SHORTNAME_ON $TRANSCRIBE_ON'
|
||||
alias yt-720-t='download_youtube_vid "136+140" $SHORTNAME_OFF $TRANSCRIBE_ON'
|
||||
alias yt-720-shortname-t='download_youtube_vid "136+140" $SHORTNAME_ON $TRANSCRIBE_ON'
|
||||
#---------------------------
|
||||
alias yt-playlist='download_youtube_playlist ""'
|
||||
alias yt-playlist-1080='download_youtube_playlist "137+140"'
|
||||
alias yt-playlist-720='download_youtube_playlist "136+140"'
|
||||
alias yt-playlist-720='download_youtube_playlist "136+140"'
|
||||
alias yt-playlist-tiny='download_youtube_playlist "160+140"'
|
||||
alias yt-audio='yt-dlp.exe -f "140"'
|
||||
alias yt-and-hflip='download_youtube_vid_and_hflip "137+140"' # 1080p
|
||||
|
||||
#-------------------------------------------------
|
||||
# Twitch Vid DL
|
||||
alias tw='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_OFF'
|
||||
alias twt='download_twitch_vid_and_transcribe "" $SHORTNAME_OFF $COMPRESSION_OFF'
|
||||
alias tw-compressed='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_ON'
|
||||
alias tw-shortname='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_OFF'
|
||||
alias tw-shortname-compressed='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_ON'
|
||||
alias tw-custom='download_twitch_vid '
|
||||
#-------------------------------------------------
|
||||
alias tw-chat='download_twitch_chat'
|
||||
|
||||
alias tw-1080='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_OFF'
|
||||
alias tw-1080-compressed='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON'
|
||||
alias tw-1080-shortname='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_OFF'
|
||||
alias tw-1080-shortname-compressed='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON'
|
||||
alias tw='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_OFF $TRANSCRIBE_OFF'
|
||||
alias tw-compressed='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-shortname='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_OFF $TRANSCRIBE_OFF'
|
||||
alias tw-shortname-compressed='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-source='download_twitch_vid "Source" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-custom='download_twitch_vid '
|
||||
#TRANSCRIPTION ON
|
||||
alias twt='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_OFF $TRANSCRIBE_ON'
|
||||
alias tw-compressed-t='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-shortname-t='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_OFF $TRANSCRIBE_ON'
|
||||
alias tw-shortname-compressed-t='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-source-t='download_twitch_vid "Source" "Source" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
|
||||
alias tw-1080p60='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_OFF'
|
||||
alias tw-1080p50='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_OFF'
|
||||
alias tw-1080p60-compressed='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON'
|
||||
alias tw-1080p50-compressed='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON'
|
||||
alias tw-1080p60-shortname='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_OFF'
|
||||
alias tw-1080p50-shortname='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_OFF'
|
||||
alias tw-1080p60-shortname-compressed='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON'
|
||||
alias tw-1080p50-shortname-compressed='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON'
|
||||
#1080p
|
||||
alias tw-1080='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-1080-compressed='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-1080-shortname='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-1080-shortname-compressed='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
#TRANSCRIPTION ON
|
||||
alias tw-1080-t='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-1080-compressed-t='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-1080-shortname-t='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-1080-shortname-compressed-t='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
|
||||
alias tw-720='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_OFF'
|
||||
alias tw-720-compressed='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON'
|
||||
alias tw-720-shortname='download_twitch_vid "720p" $SHORTNAME_ON $COMPRESSION_OFF'
|
||||
alias tw-720p60='download_twitch_vid "720p60" $SHORTNAME_OFF $COMPRESSION_OFF'
|
||||
alias tw-720p60-shortname='download_twitch_vid "720p60" $SHORTNAME_ON $COMPRESSION_OFF'
|
||||
#1080p60/50
|
||||
alias tw-1080p60='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-1080p50='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-1080p60-compressed='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-1080p50-compressed='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-1080p60-shortname='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-1080p50-shortname='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-1080p60-shortname-compressed='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-1080p50-shortname-compressed='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
#TRANSCRIPTION ON
|
||||
alias tw-1080p60-t='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-1080p50-t='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-1080p60-compressed-t='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-1080p50-compressed-t='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-1080p60-shortname-t='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-1080p50-shortname-t='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-1080p60-shortname-compressed-t='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-1080p50-shortname-compressed-t='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
|
||||
alias tw-4k='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_OFF'
|
||||
alias tw-4k-compressed='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON'
|
||||
alias tw-4k-shortname='download_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_OFF'
|
||||
alias tw-4k-shortname-compressed='download_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON'
|
||||
#720p
|
||||
alias tw-720='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-720-compressed='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-720-shortname='download_twitch_vid "720p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-720p60='download_twitch_vid "720p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-720p60-shortname='download_twitch_vid "720p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
#TRANSCRIPTION ON
|
||||
alias tw-720-t='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-720-compressed-t='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-720-shortname-t='download_twitch_vid "720p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-720p60-t='download_twitch_vid "720p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-720p60-shortname-t='download_twitch_vid "720p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
|
||||
alias tw-source='download_twitch_vid "Source" $SHORTNAME_OFF $COMPRESSION_OFF'
|
||||
#4k
|
||||
alias tw-4k='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-4k-compressed='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-4k-shortname='download_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias tw-4k-shortname-compressed='download_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
#TRANSCRIPTION ON
|
||||
alias tw-4k-t='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-4k-compressed-t='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-4k-shortname-t='download_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias tw-4k-shortname-compressed-t='download_twitch_vi "2160p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
# Vimeo Vid DL
|
||||
alias vimeo='download_vimeo_vid "Original" $SHORTNAME_OFF $COMPRESSION_OFF'
|
||||
alias vimeo-compressed='download_vimeo_vid "Original" $SHORTNAME_OFF $COMPRESSION_ON'
|
||||
#-------------------------------------------------
|
||||
alias vimeo='download_vimeo_vid $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias vimeo-t='download_vimeo_vid $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
alias vimeo-compressed='download_vimeo_vid $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
|
||||
alias vimeo-compressed-t='download_vimeo_vid $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
|
||||
|
||||
#-------------------------------------------------
|
||||
# Instagram Vid DL
|
||||
alias ig-download-and-hflip='download_instagram_vid_and_hflip '
|
||||
#-------------------------------------------------
|
||||
alias ig='download_instagram_vid $TRANSCRIBE_OFF'
|
||||
alias igt='download_instagram_vid $TRANSCRIBE_ON'
|
||||
|
||||
#-------------------------------------------------
|
||||
# Twitter Vid DL
|
||||
#-------------------------------------------------
|
||||
alias twitter='download_twitter_vid "" '
|
||||
|
||||
#-------------------------------------------------
|
||||
# Misc
|
||||
#-------------------------------------------------
|
||||
alias download-mp4='download_mp4'
|
||||
alias download-from-m3u8='download_from_m3u8'
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user