Linux下載YouTube影片的Shell Script(轉)

Linux下载YouTube影片的Shell Script(转)2008-06-09 15:54当我看到这个Shell Script的时候,简直佩服作者的Shell Scripting功夫放在这里给有需要的人用法:将下面的代码复制然后储存为youtube.sh CODE:[Copy to clipboard]#!/bin/sh#$Id:youtube.sh 496 2006-06-05 23:37:35Z berto$if["$#"!=",youtube臺灣;1"];then echo"YouTube Video Downloader"echo"Written by Alberto Garcia"echo"Homepage:echo echo"Usage:"echo"youtube.sh echo"or"echo"youtube.sh"echo exit 64 fi VID=$(echo"$1"|sed"s/.*v=\([^&]*\).*/\1/")URL1="echo-n"Getting$URL1."PARAM="$(wget-q-O-"$URL1"|grep watch_fullscreen|cut-d'&'-f 3)"echo"done."URL2="echo-n"Getting$URL2."URL3="$(wget-S"$URL2"2&1|sed-n/Location:/s/.*http:/http:/p)"echo"done."echo"Video address is$URL3"exec wget-O"$VID.flv""$URL3"我在下面加了两行,使它下载后自动把flv转成mpg:CODE:[Copy to clipboard]exec ffmpeg-i"$VID.flv"-ab 56-ar 22050-b 500-s 320x240"$VID.mpg"exec rm"$VID.flv"