Skip to content

Commit c13748b

Browse files
committed
updated youtube_download_video.sh
1 parent 9a775d6 commit c13748b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: media/youtube_download_video.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ min_args 1 "$@"
4545
max_args 2 "$@"
4646

4747
url="$1"
48-
filename="${2:-%(title)s}.%(ext)s"
48+
output_filename="${2:-%(title)s}.%(ext)s"
4949

5050
#"$srcdir/../packages/install_packages_if_absent.sh" yt-dlp ffmpeg
5151

@@ -87,11 +87,12 @@ yt-dlp \
8787
--continue \
8888
--no-overwrite \
8989
--retries 50 \
90-
--output "$filename" \
90+
--output "$output_filename" \
9191
${DEBUG:+--verbose} \
9292
"$url"
9393

9494
if [ "${2:-}" ]; then
95+
# quicker and should always be the arg and .mp4 due to the --format options above
9596
filename="$2.mp4"
9697
else
9798
# if the filename isn't specified, we can infer it since no filename specified means no path specified so
@@ -101,7 +102,7 @@ else
101102
# the wrong video
102103
#"$srcdir/vidopen.sh" "$(ls -t ./*.mp4 | head -n1)"
103104
timestamp "Determining download filename"
104-
filename="$(yt-dlp --get-filename --output "$filename" "$url")"
105+
filename="$(yt-dlp --get-filename --output "$output_filename" "$url")"
105106
fi
106107
timestamp "Touching file timestamp to make it easier to find when browsing"
107108
touch "$filename"

0 commit comments

Comments
 (0)