Skip to content

Instantly share code, notes, and snippets.

@kyokuheki
Forked from hobbsh/kubecon_curl.sh
Last active May 29, 2019 03:59
Show Gist options
  • Save kyokuheki/faa406eb36fbfc284b1e752c977063d6 to your computer and use it in GitHub Desktop.
Save kyokuheki/faa406eb36fbfc284b1e752c977063d6 to your computer and use it in GitHub Desktop.
Download Kubecon 2019 EU presentations from Sched
#!/bin/bash
DAYS=("2019-05-21" "2019-05-22" "2019-05-23" "2019-05-20")
SUBDOMAIN=kccnceu19
mkdir -p kubecon_files
for DAY in "${DAYS[@]}"; do
#Super shitty pipefest because of grep matched groups sadness
LINKS=($(curl https://${SUBDOMAIN}.sched.com/${DAY}/overview | grep -oEi "f='(.*)' cl" | cut -d\' -f 2 | tr '\n' ' '))
for LINK in "${LINKS[@]}"; do
echo "Requesting https://${SUBDOMAIN}.sched.com/${LINK}"
#Find file link on event page
FILE_URL=$(curl -s https://${SUBDOMAIN}.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'`
echo downloading $FILE_URL $FILENAME
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