-
-
Save kyokuheki/f6f2782eb9ad215a3fb64a6e09da948e 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 | |
| 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=`cut -d/ -f4 <<<${LINK} | tr -d '%20'`.pdf | |
| 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