Skip to content

Instantly share code, notes, and snippets.

@superbrothers
Forked from hobbsh/kubecon_curl.sh
Last active December 11, 2017 04:52
Show Gist options
  • Save superbrothers/0beaa2f07bf7e23b4a485b3763d1e8b1 to your computer and use it in GitHub Desktop.
Save superbrothers/0beaa2f07bf7e23b4a485b3763d1e8b1 to your computer and use it in GitHub Desktop.
Download Kubecon Austin 2017 presentations from Sched
#!/bin/bash
mkdir -p kubecon_files
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'`
if [[ ! -f "kubecon_files/${FILENAME}" ]]; then
echo "Downloading ${FILENAME}"
curl -o kubecon_files/${FILENAME} -s ${FILE_URL}
fi
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment