Created
June 27, 2019 10:18
-
-
Save pqrth/9a01dd829fd41abfb71485029bce89de to your computer and use it in GitHub Desktop.
Bash script to download all the episodes in a podcast XML feed
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 | |
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