update-yt-subs.sh

download

see post 888b507c473245958db80201027e93d5

            
#!/bin/bash
# ██████╗ ██████╗ ██╗██╗   ██╗ █████╗  ██████╗██╗   ██╗████████╗ ██████╗ ██████╗  █████╗ ██╗   ██╗
# ██╔══██╗██╔══██╗██║██║   ██║██╔══██╗██╔════╝╚██╗ ██╔╝╚══██╔══╝██╔═══██╗██╔══██╗██╔══██╗╚██╗ ██╔╝
# ██████╔╝██████╔╝██║██║   ██║███████║██║      ╚████╔╝    ██║   ██║   ██║██║  ██║███████║ ╚████╔╝ 
# ██╔═══╝ ██╔══██╗██║╚██╗ ██╔╝██╔══██║██║       ╚██╔╝     ██║   ██║   ██║██║  ██║██╔══██║  ╚██╔╝  
# ██║     ██║  ██║██║ ╚████╔╝ ██║  ██║╚██████╗   ██║      ██║   ╚██████╔╝██████╔╝██║  ██║   ██║   
# ╚═╝     ╚═╝  ╚═╝╚═╝  ╚═══╝  ╚═╝  ╚═╝ ╚═════╝   ╚═╝      ╚═╝    ╚═════╝ ╚═════╝ ╚═╝  ╚═╝   ╚═╝   
# @PrivacyToday on Telegram
# You can stop the current download safely with CTRL+C and resume later. No need to download everything at once.
SUB_LANG=en     # your language
MAX_HEIGHT=720  # maximum height like 480,720,1080 etc
# Enter your videos/channels/playlists here. You can put the title in a comment.
VIDEOS=(
"https://www.youtube.com/channel/UC7_gcs09iThXybpVgjHZ_7g"                  # PBS Space Time Channel
"https://www.youtube.com/watch?v=7UwigY4SjKY"                               # single video
"https://www.youtube.com/playlist?list=PLGnWLXjIDnpBBsdKZb-vy30o88SIxItp2"  # playlist
)
######################################
function download {
    youtube-dl \
    --write-sub \
    --sub-lang $SUB_LANG \
    -f "bestvideo[height<=?"$MAX_HEIGHT"]+bestaudio" \
    -o 'videos/%(uploader)s/%(upload_date)s - %(title)s [%(resolution)s].%(ext)s' \
    --embed-subs \
    --sub-format ttml \
    --convert-subs srt \
    --merge-output-format mkv \
    --external-downloader aria2c \
    --external-downloader-args "--file-allocation=prealloc --min-split-size=1M --split=16 --max-connection-per-server=10" \
    --download-archive "_archive.txt" \
    --no-check-certificate \
    $1
}
trap "exit" INT
for i in "${VIDEOS[@]}"
do
    download $i
done