Get video id from new endpoint

This commit is contained in:
vwheezy22 2021-07-27 12:46:19 -07:00
parent df17c52c87
commit 6605ff47ce

23
yuja-dl
View File

@ -8,8 +8,8 @@
function download_url { function download_url {
local url="$1"; local output="$2" local url="$1"; local output="$2"
local id="$(echo "$url" | video_id)"
local sub="$(echo "$url" | subdomain)" local sub="$(echo "$url" | subdomain)"
local id="$(video_metadata "$url" "$sub" | video_pid)"
local captions_key="$(get_metadata "$sub" "$id" | caption_file_key)" local captions_key="$(get_metadata "$sub" "$id" | caption_file_key)"
local node_pid="$(get_metadata "$sub" "$id" | video_node_pid)" local node_pid="$(get_metadata "$sub" "$id" | video_node_pid)"
@ -39,6 +39,10 @@ function video_node_pid {
| jq -r .videoListNodePID | jq -r .videoListNodePID
} }
function video_pid {
jq -r .videoPID
}
#--------------------------------------- #---------------------------------------
function get_node_metadata { function get_node_metadata {
@ -79,16 +83,23 @@ function caption_url {
#--------------------------------------- #---------------------------------------
function video_id {
sed 's%.*v=%%' \
| sed 's%&.*%%'
}
function subdomain { function subdomain {
awk -F '.' '{print $1}' \ awk -F '.' '{print $1}' \
| sed 's%.*//%%' | sed 's%.*//%%'
} }
function video_uid {
sed 's%.*u=%%' \
| sed 's%&.*%%'
}
function video_metadata {
local url="$1"; local sub="$2"
local uid="$(echo "$url" | video_uid)"
curl -b "$COOKIES" -s \
"https://${sub}.yuja.com/V/VideoDecryptLogicServlet?u=${uid}"
}
# INVOCATION # INVOCATION
# -------------------------------------- # --------------------------------------
function usage { function usage {