mirror of
https://github.com/iv-org/youtube-utils.git
synced 2024-10-01 03:45:35 -04:00
Avoid redundant code for interactive parameters query
This commit is contained in:
parent
c7eb46c7bb
commit
0a9b21ce5f
@ -262,12 +262,6 @@ case $endpoint_option in
|
||||
if [ -z $browse_id ]; then browse_id="UCXuqSBlHAE6Xw-yeJA0Tunw"; fi
|
||||
partial_data="\"browseId\":\"${browse_id}\""
|
||||
|
||||
printf "Enter optional parameters (base64-encoded protobuf) []: "
|
||||
read params
|
||||
|
||||
if [ ! -z $params ]; then
|
||||
partial_data="${partial_data},\"params\":\"${params}\""
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
@ -292,16 +286,6 @@ case $endpoint_option in
|
||||
|
||||
if [ -z $vid ]; then vid="dQw4w9WgXcQ"; fi
|
||||
partial_data="\"videoId\":\"${vid}\""
|
||||
|
||||
|
||||
if [ "$endpoint_option" = "player" ]; then
|
||||
printf "Enter optional parameters (base64-encoded protobuf) []: "
|
||||
read params
|
||||
|
||||
if [ ! -z $params ]; then
|
||||
partial_data="${partial_data},\"params\":\"${params}\""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
@ -338,6 +322,28 @@ case $endpoint_option in
|
||||
esac
|
||||
|
||||
|
||||
#
|
||||
# Interactively request additional parameters for the supported endpoints
|
||||
#
|
||||
|
||||
if [ $interactive = true ]
|
||||
then
|
||||
case $endpoint_option in
|
||||
|
||||
browse|player)
|
||||
params=$(query_with_default "Enter optional parameters (base64-encoded protobuf)" "")
|
||||
|
||||
if [ ! -z $params ]; then
|
||||
partial_data="${partial_data},\"params\":\"${params}\""
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# new line
|
||||
echo
|
||||
|
||||
|
||||
#
|
||||
# Interactive language/region selection
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user