Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Get a video code from $1 or STDIN.
- jav_name() {
- if [ -z "$1" ]; then
- read name
- else
- name="$1"
- fi
- echo $name
- }
- # Return the JSON for available video streams.
- jav_urls_json() {
- name=$1
- 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')"
- echo $json
- }
- # Play the lowest quality video.
- jav_play_low() {
- name=$1
- language=$(echo $name | grep -q -E 'c$' && echo 'Chinese' || echo 'Japanese')
- json=$(jav_urls_json $name)
- [ -n "$json" ] && {
- quality=$(echo $json | jq -r '.[0].label')
- link=$(echo $json | jq -r '.[0].file')
- echo "Playing $quality $language"
- mpv "$link"
- exit 0
- }
- }
- # Get the Chinese and Japanese codes for the video in $code_cn and $code_ja.
- code=$(jav_name $1)
- if echo $code | grep -q -E 'c$' ; then
- code_cn=$code
- code_ja=$(echo $code | sed 's/c$//')
- else
- code_cn="${code}c"
- code_ja=$code
- fi
- # Try Chinese; then try Japanese.
- jav_play_low $code_cn || jav_play_low $code_ja || {
- echo "No SD quality was found."
- exit 1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement