Advertisement
Guest User

Untitled

a guest
Feb 25th, 2021
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #!/bin/sh
  2. # slightly useful POC on using the new vlive update
  3. case $1 in
  4. -h|"") printf "usage: $(basename $0) [-h|-d|-l] URL\n" && exit 0 ;;
  5. -d) url="$2" || url="$1" ;;
  6. *) url="$1"
  7. esac
  8.  
  9. json=$(curl -sL "$url" \
  10. | awk -F'.*window\\.__PRELOADED_STATE__=|</script>' '{
  11. print $2
  12. }')
  13. vodId=$(echo "$json" | jq -r '.postDetail.post.officialVideo.vodId')
  14. videoSeq=$(echo "$json" | jq -r '.postDetail.post.officialVideo.videoSeq')
  15. key=$(curl -s -e "https://www.vlive.tv/" \
  16. "https://www.vlive.tv/globalv-web/vam-web/video/v1.0/vod/$videoSeq/inkey" \
  17. | jq -r '.inkey')
  18. metadata=$(curl -s "https://apis.naver.com/rmcnmv/rmcnmv/vod/play/v2.0/$vodId?key=$key&videoId=$vodId")
  19.  
  20. video=$(echo "$metadata" | jq -r '.videos.list | max_by(.bitrate.video).source')
  21. title="$videoSeq-[V LIVE] $(echo "$json" | jq -r '.postDetail.post.title')"
  22.  
  23. [ "$1" = "-d" ] && aria2c -o "${title}.mp4" "$video" \
  24. || mpv --title="$title - mpv" "$video"
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement