mirror of
https://gitea.invidious.io/iv-org/youtube-utils.git
synced 2024-08-15 00:53:16 +00:00
Avoid redundant code for interactive parameters query
This commit is contained in:
parent
c7eb46c7bb
commit
0a9b21ce5f
1 changed files with 22 additions and 16 deletions
|
@ -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 a new issue