Advertisement
Guest User

jav-lo

a guest
Mar 16th, 2021
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.22 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Get a video code from $1 or STDIN.
  4. jav_name() {
  5.   if [ -z "$1" ]; then
  6.     read name
  7.   else
  8.     name="$1"
  9.   fi
  10.   echo $name
  11. }
  12.  
  13. # Return the JSON for available video streams.
  14. jav_urls_json() {
  15.   name=$1
  16.   json="$(curl -s "$(curl -s "https://www2.javhdporn.net/video/$name/" | grep "embedURL" | grep -o "{.*}" | jq '.["@graph"]' | jq -r '.[].embedURL' | sed '/^null$/d' | sed 's/\/v\//\/api\/source\//')" --data-raw 'r=&d=javmvp.com' | jq -r '.data')"
  17.  echo $json
  18. }
  19.  
  20. # Play the lowest quality video.
  21. jav_play_low() {
  22.  name=$1
  23.  language=$(echo $name | grep -q -E 'c$' && echo 'Chinese' || echo 'Japanese')
  24.  json=$(jav_urls_json $name)
  25.  [ -n "$json" ] && {
  26.    quality=$(echo $json | jq -r '.[0].label')
  27.    link=$(echo $json | jq -r '.[0].file')
  28.    echo "Playing $quality $language"
  29.    mpv "$link"
  30.    exit 0
  31.  }
  32. }
  33.  
  34. # Get the Chinese and Japanese codes for the video in $code_cn and $code_ja.
  35. code=$(jav_name $1)
  36. if echo $code | grep -q -E 'c$' ; then
  37.  code_cn=$code
  38.  code_ja=$(echo $code | sed 's/c$//')
  39. else
  40.  code_cn="${code}c"
  41.  code_ja=$code
  42. fi
  43.  
  44. # Try Chinese; then try Japanese.
  45. jav_play_low $code_cn || jav_play_low $code_ja || {
  46.  echo "No SD quality was found."
  47.  exit 1
  48. }
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement