larigira-scripts/podcast
boyska 0ebb62c318 ADD podcast; very basic support for podcast
if your audio source has podcast, great news! this script will add
**BASIC** support for podcasts. It will just download the first audio it
finds in the xml.
2019-11-04 00:29:44 +01:00

13 lines
371 B
Bash
Executable file

#!/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