Skip to content

Instantly share code, notes, and snippets.

@pqrth
Created June 27, 2019 10:18
Show Gist options
  • Save pqrth/9a01dd829fd41abfb71485029bce89de to your computer and use it in GitHub Desktop.
Save pqrth/9a01dd829fd41abfb71485029bce89de to your computer and use it in GitHub Desktop.
Bash script to download all the episodes in a podcast XML feed
#!/bin/bash
SAVE_DIR=$1
# Check the availiable podcasts and download them to local storage
# TODO: Split up at some point since files could potentially be too big
for url in "${@:2}"
do
str=$(wget -P $SAVE_DIR -q -O- $url | grep -o '<enclosure [^>]*url="[^"]*' | grep -o '[^"]*$' | head -n 1)
str=${str##*/}
# Replace url encoding spaces with real ones
str=${str//%20/ }
wget -P $SAVE_DIR -q -O- $url | grep -o '<enclosure [^>]*url="[^"]*' | grep -o '[^"]*$' | xargs wget -c -P $SAVE_DIR > /dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment