Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # slightly useful POC on using the new vlive update
- case $1 in
- -h|"") printf "usage: $(basename $0) [-h|-d|-l] URL\n" && exit 0 ;;
- -d) url="$2" || url="$1" ;;
- *) url="$1"
- esac
- json=$(curl -sL "$url" \
- | awk -F'.*window\\.__PRELOADED_STATE__=|</script>' '{
- print $2
- }')
- vodId=$(echo "$json" | jq -r '.postDetail.post.officialVideo.vodId')
- videoSeq=$(echo "$json" | jq -r '.postDetail.post.officialVideo.videoSeq')
- key=$(curl -s -e "https://www.vlive.tv/" \
- "https://www.vlive.tv/globalv-web/vam-web/video/v1.0/vod/$videoSeq/inkey" \
- | jq -r '.inkey')
- metadata=$(curl -s "https://apis.naver.com/rmcnmv/rmcnmv/vod/play/v2.0/$vodId?key=$key&videoId=$vodId")
- video=$(echo "$metadata" | jq -r '.videos.list | max_by(.bitrate.video).source')
- title="$videoSeq-[V LIVE] $(echo "$json" | jq -r '.postDetail.post.title')"
- [ "$1" = "-d" ] && aria2c -o "${title}.mp4" "$video" \
- || mpv --title="$title - mpv" "$video"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement