Skip to content

Instantly share code, notes, and snippets.

@emanuele6
Last active June 20, 2022 18:02
Show Gist options
  • Save emanuele6/a76652d5feaa3c044047b4d46813076f to your computer and use it in GitHub Desktop.
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).
#!/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