youtube.sh
Inviato: 08 gen 2008, 12:21
Ho trovato un simpatico script di shell che sfrutta wget per scaricare video in formato .flv da YouTube:
dato che vdr tramite mplayer puo' vedere i .flv perchè non approfittarne? 
Sarebbe carino un pluggo che sfrutta questo scipt per passare diretamente ad mplayer il video...
Codice: Seleziona tutto
#!/bin/sh
if [ "$#" != "0"]; then
echo "YouTube Video Downloader"
echo
echo "Uso:"
echo " youtube.sh http://www.youtube.com/watch?v=<video_ID>"
echo " o"
echo " youtube.sh <video_ID>"
echo
exit 64
fi
VID=$(echo "$1"|sed "s/.*v=\([^&]*\).*/\1/")
URL1="http://www.youtube.com/watch?v=$VID"
echo -n "Scarico $URL1 …"
PARAM="$(wget -q -O - "$URL1"|grep watch_fullscreen|cut -d '&' -f 3)"
echo " Finito!"
URL2="http://www.youtube.com/get_video?video_id=$VID&$PARAM"
echo -n "Scarico $URL2 …"
URL3="$(wget -S "$URL2" 2>&1|sed -n /Location:/s/.*http:/http:/p)"
echo " Finito!"
echo "Video address is $URL3"
exec wget -O "$VID.flv" "$URL3"

Sarebbe carino un pluggo che sfrutta questo scipt per passare diretamente ad mplayer il video...