Skip to content

Instantly share code, notes, and snippets.

@seirl
Created November 5, 2017 19:41
Show Gist options
  • Save seirl/f841da721b97825263732f3b1b29ace2 to your computer and use it in GitHub Desktop.
Save seirl/f841da721b97825263732f3b1b29ace2 to your computer and use it in GitHub Desktop.
Download videos from the blizzcon website
#!/bin/bash
echo -n 'Enter your cookie header: '
read -s cookie_header
echo
tmpres=$( mktemp )
curl -s https://blizzcon.com/en-us/watch/videos \
| grep -o '.\+watch?[^"\]\+.\+data-video-title="[^"]\+"' \
| sed 's/watch?v=//' \
curl -s https://blizzcon.com/en-us/watch/videos \
| grep -P -o 'data-video-guid=\\"[^"]+\\".*?data-video-title=\\"[^"]+\\"' \
| sed 's/data-video-guid=\\"//g' \
| sed 's/\\".\+data-video-title=\\"/ /g' \
| sed 's/\\"//g' \
| recode html..utf8 \
| sed "s/'/'/g" \
| while read guid title; do
echo "Downloading $guid: $title...";
curl -s "https://blizzcon.com/en-us/watch/video/$guid" \
-H "$cookie_header" > "$tmpres"
if grep -q 'Forbidden' "$tmpres"; then
echo ' -> WARNING: Forbidden. Check your cookies.'
else
echo youtube-dl $( grep -o 'https://[^"]\+' "$tmpres" ) \
-o "$title.%(ext)s"
fi
done
rm "$tmpres"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment