aboutsummaryrefslogtreecommitdiff
path: root/src/stream_command.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/stream_command.sh')
-rw-r--r--src/stream_command.sh20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/stream_command.sh b/src/stream_command.sh
index 1333222..351ddd8 100644
--- a/src/stream_command.sh
+++ b/src/stream_command.sh
@@ -1,11 +1,27 @@
+user_agent="${args['--user-agent']}"
+
+if [[ -n "${user_agent}" ]]; then
+ user_agent="--user-agent=${user_agent}"
+fi
+
if [[ -n "${args['--download']}" ]]; then
START=$(date +%s)
- yt-dlp --format 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' --cookies-from-browser "${args[--browser]}" --all-subs --embed-subs "${args[uri]}"
+ yt-dlp \
+ --format 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' \
+ --cookies-from-browser "${args[--browser]}" \
+ --all-subs \
+ --embed-subs \
+ "${user_agent}" \
+ "${args[uri]}"
printf "\ntook %s seconds\n" $(($(date +%s || true) - START))
return
fi
-mpv --ytdl-raw-options-append=format='bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' --ytdl-raw-options-append=cookies-from-browser="${args[--browser]}" "${args[uri]}"
+mpv \
+ --ytdl-raw-options-append=format='bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' \
+ --ytdl-raw-options-append=cookies-from-browser="${args[--browser]}" \
+ "${user_agent}" \
+ "${args[uri]}"