Skip to content

Instantly share code, notes, and snippets.

@arekolek
Created April 14, 2012 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arekolek/2386012 to your computer and use it in GitHub Desktop.
Save arekolek/2386012 to your computer and use it in GitHub Desktop.
Download Coachella 2012 YouTube live stream
#!/bin/bash
usage()
{
cat << EOF
Usage: $0 [OPTIONS] STREAM_NUMBER
Downloads Coachella YouTube live stream number STREAM_NUMBER (required, one of 1, 2 or 3).
Stop the download simply with CTRL-C.
Any options after STREAM_NUMBER will be ignored.
OPTIONS:
-h Show this message
-q Video quality, one of:
- nHD (640x360)
- qHD (960x540)
- HD (1280x720)
Default is HD.
-o Output file name.
Default is coachella{STREAM_NUMBER}.flv
EXAMPLES:
$0 2 - download second stream in HD to default location
$0 -q nHD -o m83.flv 1 - download first stream in nHD and save as m83.flv
EOF
}
OUT=
QUAL="3500"
STREAM=
CODE=
while getopts "ho:q:" opt; do
case $opt in
h)
usage
exit;;
o)
OUT=$OPTARG;;
q)
case $OPTARG in
HD) QUAL="3500";;
qHD) QUAL="1900";;
nHD) QUAL="900";;
* )
usage
exit 1;;
esac
esac
done
shift $(( OPTIND -1 ))
STREAM=$1
# print help if stream z
if [[ -z $STREAM ]]; then
usage
exit 1
fi
case $STREAM in
1) CODE="46685";;
2) CODE="62051";;
3) CODE="62052";;
* )
usage
exit 1;;
esac
if [[ -z $OUT ]]; then
OUT="coachella$STREAM.flv"
fi
echo "Press ctrl-c to stop downloading"
curl "http://aegdmcoachella-f.akamaihd.net/coachella_${STREAM}_${QUAL}@${CODE}?v=2.6.8&fp=LNX%2011,2,202,228&r=RSXRR&g=DCXWLHWROSLK" > $OUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment