-
-
Save teejaded/c0c2d9f3dad2f4cca856416a9ab1714d to your computer and use it in GitHub Desktop.
Download kubecon na 2018 presentations from Sched
This file contains 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 | |
function process_link() { | |
local LINK FILE_URL FILE_URLS FILENAME | |
LINK=$1 | |
FILE_URLS=$(curl -s https://kccna18.sched.com${LINK} | grep "file-uploaded" | cut -d\" -f 4) | |
for FILE_URL in $FILE_URLS; do | |
FILENAME=${LINK#https:*} | |
FILENAME="${FILENAME##/*/}.${FILE_URL##*.}" | |
echo "Downloading $FILENAME" >&2 | |
echo "kubecon/${FILENAME}" "${FILE_URL}" | |
done | |
} | |
export -f process_link | |
mkdir -p kubecon | |
echo "2018-12-11 2018-12-13 2018-12-12" | \ | |
xargs -I{} -n1 -P2 curl -s https://kccna18.sched.com/{}/overview | \ | |
grep -oEi "f='(.*)' cl" | \ | |
cut -d\' -f 2 | \ | |
tr '\n' ' ' | \ | |
xargs -I{} -n1 -P32 bash -c 'process_link "$@"' _ {} | \ | |
xargs -n2 -P32 curl -s -o |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment