Switch from youtube-dl to actively maintained yt-dlp

This commit is contained in:
Michael Campagnaro 2021-10-14 14:20:25 -04:00
parent f4cd359142
commit 9ae1fcb852

30
aliases
View File

@ -332,7 +332,7 @@ make_vid_dir_and_cd_into() {
if [[ $dir_name == "" ]]; then
# @note If the filename contains symbols that are incompatible with
# Windows' directory names then add --restrict-filenames to the command.
dir_name=$(youtube-dl.exe --get-filename -o "%(upload_date)s - %(title)s" $opts $url)
dir_name=$(yt-dlp.exe --get-filename -o "%(upload_date)s - %(title)s" $opts $url)
if [[ $dir_name == "" ]]; then
return 1
@ -386,10 +386,10 @@ dl_youtube_vid() {
local name_format="%(upload_date)s-shortname-youtube-%(id)s"
fi
local filename=$(youtube-dl.exe --get-filename -o "$name_format.%(ext)s" $url)
local filename=$(yt-dlp.exe --get-filename -o "$name_format.%(ext)s" $url)
filename="${filename:0:4}-${filename:4:2}-${filename:6}"
youtube-dl.exe -f $format -o "$filename" $opts $url
yt-dlp.exe -f $format -o "$filename" $opts $url
if [[ $make_folder == "1" ]]; then
cd ..
@ -418,13 +418,13 @@ dl_youtube_vid_and_hflip() {
fi
fi
local filename=$(youtube-dl.exe --get-filename -o "%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s" $url)
local filename=$(yt-dlp.exe --get-filename -o "%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s" $url)
filename="${filename:0:4}-${filename:4:2}-${filename:6}"
if [[ $format == "" ]]; then
youtube-dl.exe -o "$filename" $opts $url
yt-dlp.exe -o "$filename" $opts $url
else
youtube-dl.exe -f $format -o "$filename" $opts $url
yt-dlp.exe -f $format -o "$filename" $opts $url
fi
# Flip
@ -461,9 +461,9 @@ dl_youtube_playlist() {
local name_format="v%(playlist_index)s--%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s"
if [[ $format == "" ]]; then
youtube-dl.exe -o "$name_format" $opts $url
yt-dlp.exe -o "$name_format" $opts $url
else
youtube-dl.exe -f $format -o "$name_format" $opts $url
yt-dlp.exe -f $format -o "$name_format" $opts $url
fi
cd ..
@ -499,7 +499,7 @@ dl_twitch_chat() {
return
fi
actually_dl_twitch_chat $url "$(youtube-dl.exe --get-filename -o "%(upload_date)s-%(title)s-twitch-%(id)s" $opts $url)"
actually_dl_twitch_chat $url "$(yt-dlp.exe --get-filename -o "%(upload_date)s-%(title)s-twitch-%(id)s" $opts $url)"
cd ..
}
@ -552,13 +552,13 @@ dl_twitch_vid() {
fi
# Download Twitch chat transcript
actually_dl_twitch_chat $url "$(youtube-dl.exe --get-filename -o "$name_format" $opts $url)"
actually_dl_twitch_chat $url "$(yt-dlp.exe --get-filename -o "$name_format" $opts $url)"
# Download the video.
local filename=$(youtube-dl.exe --get-filename -o "$name_format.%(ext)s" $opts $url)
local filename=$(yt-dlp.exe --get-filename -o "$name_format.%(ext)s" $opts $url)
filename="${filename:0:4}-${filename:4:2}-${filename:6}"
youtube-dl.exe -f "$format" -o "$filename" $opts $url
yt-dlp.exe -f "$format" -o "$filename" $opts $url
error=$?
if [[ $error -eq 0 ]]; then
@ -615,10 +615,10 @@ dl_vimeo_vid() {
fi
# Download the video.
local filename=$(youtube-dl.exe --get-filename -o "$name_format.%(ext)s" $opts $url)
local filename=$(yt-dlp.exe --get-filename -o "$name_format.%(ext)s" $opts $url)
filename="${filename:0:4}-${filename:4:2}-${filename:6}"
youtube-dl.exe -f "$format" -o "$filename" $opts $url
yt-dlp.exe -f "$format" -o "$filename" $opts $url
error=$?
if [[ $error -eq 0 ]]; then
@ -722,7 +722,7 @@ alias yt-playlist='dl_youtube_playlist ""'
alias yt-playlist-1080='dl_youtube_playlist "137+140"'
alias yt-playlist-720='dl_youtube_playlist "136+140"'
alias yt-playlist-tiny='dl_youtube_playlist "160+140"'
alias yt-audio='youtube-dl.exe -f "140"'
alias yt-audio='yt-dlp.exe -f "140"'
alias yt-and-hflip='dl_youtube_vid_and_hflip "137+140"' # 1080p
alias ig-download-and-hflip='dl_instagram_vid_and_hflip '