/ Published in: Bash
Un programa en español que baja y convierte a varios formatos de video los videos de Youtube.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/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 if [ $? != 0 ]; then rm -f ${FILE}.flv exit 1 else echo "Formato (avi , mpg o wmv): " read formato ffmpeg -i ${FILE}.flv ${FILE}.$formato fi fi rm -f /tmp/${FILE}