Skip to content

Instantly share code, notes, and snippets.

@teejaded
Forked from alex-slynko/kubecon_curl.sh
Last active May 23, 2019 08:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save teejaded/c0c2d9f3dad2f4cca856416a9ab1714d to your computer and use it in GitHub Desktop.
Save teejaded/c0c2d9f3dad2f4cca856416a9ab1714d to your computer and use it in GitHub Desktop.
Download kubecon na 2018 presentations from Sched
#!/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