Posted By

Distrotest on 02/15/08


Tagged

YouTube


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Balamir


Downloader y conversor de videos de YouTube


 / Published in: Bash
 

Un programa en español que baja y convierte a varios formatos de video los videos de Youtube.

  1. #!/bin/bash
  2.  
  3. if [ $# -lt 1 ]; then
  4. echo "Uso: $0 "
  5. exit 1
  6. fi
  7.  
  8. ID=`echo $1 | cut -d= -f2 | cut -d\& -f1`
  9. FILE="youtube-${ID}"
  10. BASE_URL="http://youtube.com/get_video.php"
  11.  
  12. wget -O /tmp/${FILE} $1
  13.  
  14. if [ $? == 0 ]; then
  15. T_PARAM=`grep '&t=' /tmp/${FILE} | head -n 1 | awk -F'&t=' '{print $2}' | cut -d\& -f 1`
  16. VIDEO_URL="${BASE_URL}?video_id=${ID}&t=${T_PARAM}"
  17.  
  18. wget -O ${FILE}.flv $VIDEO_URL
  19.  
  20. if [ $? != 0 ]; then
  21. rm -f ${FILE}.flv
  22. exit 1
  23. else
  24. echo "Formato (avi , mpg o wmv): "
  25. read formato
  26. ffmpeg -i ${FILE}.flv ${FILE}.$formato
  27. fi
  28. fi
  29.  
  30. rm -f /tmp/${FILE}

Report this snippet  

You need to login to post a comment.