Skip to content

Instantly share code, notes, and snippets.

@alex-slynko
Forked from hobbsh/kubecon_curl.sh
Last active December 15, 2018 17:44
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save alex-slynko/2465b016873b3f441ca246fc30ceafe6 to your computer and use it in GitHub Desktop.
Save alex-slynko/2465b016873b3f441ca246fc30ceafe6 to your computer and use it in GitHub Desktop.
Download CF Boston summit presentations from Sched
#!/bin/bash
mkdir kubecon
DAYS=("2018-12-11" "2018-12-13" "2018-12-12")
for DAY in "${DAYS[@]}"; do
#Super shitty pipefest because of grep matched groups sadness
LINKS=($(curl https://kccna18.sched.com/${DAY}/overview | grep -oEi "f='(.*)' cl" | cut -d\' -f 2 | tr '\n' ' '))
for LINK in "${LINKS[@]}"; do
echo "Requesting https://kccna18.sched.com${LINK}"
#Find file link on event page
FILE_URL=$(curl -s https://kccna18.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
FILENAME=${LINK#https:*}
FILENAME="$DAY-${FILENAME##/*/}.${FILE_URL##*.}"
curl -o "kubecon/${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