Created
December 9, 2017 04:23
-
-
Save hobbsh/35091c54970fff0b86a64cd72f02e8e3 to your computer and use it in GitHub Desktop.
Download Kubecon Austin 2017 presentations from Sched
This file contains hidden or 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 | |
DAYS=("2017-12-06" "2017-12-07" "2017-12-08") | |
for DAY in "${DAYS[@]}"; do | |
#Super shitty pipefest because of grep matched groups sadness | |
LINKS=($(curl https://kccncna17.sched.com/${DAY}/overview | grep -oEi "f='(.*)' cl" | cut -d\' -f 2 | tr '\n' ' ')) | |
for LINK in "${LINKS[@]}"; do | |
echo "Requesting https://kccncna17.sched.com/${LINK}" | |
#Find file link on event page | |
FILE_URL=$(curl -s https://kccncna17.sched.com${LINK} | grep "file-uploaded" | cut -d\" -f 4) | |
#If there's an uploaded file on the page, download it | |
if [ -n "${FILE_URL}" ]; then | |
#Delete urlencoded spaces | |
FILENAME=`echo "${FILE_URL}" | cut -d/ -f7 | tr -d '%20'` | |
curl -o kubecon_files/${FILENAME} -s ${FILE_URL} | |
fi | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment