- #!/bin/bash
- set -eu
- url="$(curl -s "$1" | \
- xmlstarlet sel -T -N atom="http://www.w3.org/2005/Atom" \
- -t -m '//atom:link[@rel="enclosure"]' -v @href -n | \
- head -n 1 )"
- test -z "$url" && exit 1
- out="$(mktemp "--tmpdir=$TMPDIR" podcast-XXXXXXXX.ogg)"
- trap 'rm -f "$out"' EXIT
- wget -q "$url" -O "$out"
- echo "file://$(realpath "$out")"
- exit 0
|