Skip to content

Instantly share code, notes, and snippets.

@eos87
Created October 21, 2010 02:17
Show Gist options
  • Save eos87/637803 to your computer and use it in GitHub Desktop.
Save eos87/637803 to your computer and use it in GitHub Desktop.
down from youtube desde consola
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Uso: $0 "
exit 1
fi
ID=`echo $1 | cut -d= -f2 | cut -d\& -f1`
FILE="youtube-${ID}"
BASE_URL="http://youtube.com/get_video.php"
wget -O /tmp/${FILE} $1
if [ $? == 0 ]; then
T_PARAM=`grep '&t=' /tmp/${FILE} | head -n 1 | awk -F'&t=' '{print $2}' | cut -d\& -f 1`
VIDEO_URL="${BASE_URL}?video_id=${ID}&t=${T_PARAM}"
wget -O ${FILE}.flv $VIDEO_URL
fi
rm -f /tmp/${FILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment