Created
October 13, 2013 03:43
-
-
Save mappu/6957919 to your computer and use it in GitHub Desktop.
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 | |
# heavensgate.sh | |
# Download all current available heavensgate.co.uk podcast episodes. | |
XMLSRC="http://audiops.net/_promo/heavensgate_facebook/list_audioplayer.php" | |
BASEDL="http://audiops.net/_promo/heavensgate_facebook/" | |
OUTDIR="`dirname $0`/heavensgate" | |
mkdir -p "$OUTDIR" | |
# Get list | |
BODY=`curl -s "$XMLSRC"` | |
if [ $? -ne 0 ] ; then | |
exit 1 | |
fi | |
URLS=`echo "$BODY" | grep location | sed -re 's/^[^>]+>([^<]+)<.*$/\1/'` | |
# Download missing files | |
while read -r url ; do | |
BASENAME=`basename "$url"` | |
if [ ! -f "$OUTDIR/$BASENAME" ] ; then | |
wget -O "$OUTDIR/$BASENAME" "${BASEDL}${url}" | |
chmod 644 "$OUTDIR/$BASENAME" | |
fi | |
done <<< "$URLS" | |
# Tidy up | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment