]> zdv2.bktei.com Git - BK-2020-03.git/blobdiff - user/bkytpldl-generic
feat(user/bkfeh):Update options
[BK-2020-03.git] / user / bkytpldl-generic
index d94bfac2b4409498ab69d59c2c8ac7f16fc396ff..199ed40b4aca233b016f0b284315bebccaf02f99 100644 (file)
@@ -1,16 +1,16 @@
 #!/usr/bin/env bash
 # Desc: Download YouTube videos
 # Usage: $ ./bkytpldl-generic
-# Version: 4.1.0
+# Version: 4.2.0
 
 declare -a args; # array for yt-dlp arguments
 declare -a urls urls_rand; # array for YouTube playlist URLs
 
 # Settings
 dir_out="~/Videos/";
-urls+=("https://www.youtube.com/playlist?list=PLxxx"); # adjust me
-urls+=("https://www.youtube.com/playlist?list=PLxxx"); # adjust me
-urls+=("https://www.youtube.com/playlist?list=PLxxx"); # adjust me
+urls+=("https://www.youtube.com/playlist?list=PLxxx"); # Adjust me. YouTube playlist URL goes here
+urls+=("https://www.youtube.com/playlist?list=PLxxx"); # Adjust me. YouTube playlist URL goes here
+urls+=("https://www.youtube.com/playlist?list=PLxxx"); # Adjust me. YouTube playlist URL goes here
 
 yell() { echo "$0: $*" >&2; } # print script path and all args to stderr
 die() { yell "$*"; exit 111; } # same as yell() but non-zero exit status
@@ -22,6 +22,10 @@ if ! command -v yt-dlp 1>/dev/random 2>&1; then die "FATAL:yt-dlp not found."; f
 # Donʼt run multiple yt-dlp instances
 if pgrep "^yt-dlp$" 1>/dev/random 2>&1; then die "FATAL:yt-dlp already running."; fi;
 
+# Enable JavaScript solver via deno. See https://github.com/yt-dlp/yt-dlp/wiki/EJS#step-2-install-ejs-challenge-solver-scripts
+args+=("--remote-components");
+args+=("ejs:npm");
+
 # Check directories
 if [[ ! -d $dir_out ]]; then mkdir -p "$dir_out"; fi;
 
@@ -83,7 +87,7 @@ args+=("--download-archive" "$pathDA");
 ##   Note: `$(title).120B` shortens title to 120 bytes (useful for
 ##     titles with UTF-8 characters.
 args+=("-o");
-args+=("%(playlist)s/%(upload_date)s.%(channel)s.%(channel_id)s.%(title).120B.%(id)s.%(ext)s");
+args+=("%(playlist)s/%(upload_date)s.%(channel).32B.%(channel_id)s.%(title).120B.%(id)s.%(ext)s");
 
 ## Limit download resolution to 1080p
 args+=("-S" "res:1080");
@@ -101,7 +105,7 @@ pushd "$dir_out" || die "FATAL:Failed to change pwd to:dir_out:$dir_out";
 # == Download videos ==
 
 #yell "DEBUG:args:$(declare -p args)";  # debug command
-must yt-dlp "${args[@]}";  # execute command
+timeout "$((1*24*3600))" yt-dlp "${args[@]}";
 popd || die "FATAL:Failed to return from dir_out:$dir_out";
 
 # Author: Steven Baltakatei Sandoval