Last active
June 20, 2022 18:02
-
-
Save emanuele6/a76652d5feaa3c044047b4d46813076f to your computer and use it in GitHub Desktop.
simple script to watch videos from jcs.org with mpv (using bash, curl, xj and jq).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -- | |
if [[ $# != 1 ]]; then | |
printf >&2 'Usage: jcsvid URL\n' | |
exit 2 | |
fi | |
eval -- "$(curl -LSgs -- "$1" | xj | jq -r ' | |
first( | |
.. | .video? | arrays | | |
@sh "mpv --sub-file=\(first( | |
"https://jcs.org/\(.[].track?[]?."@"?.src? | strings)" | |
)) -- \(first( | |
"https:\(.[].source?[]?."@"?.src? | strings)" | |
))" | |
) | |
')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment