MPlayer youtube script

From MultimediaWiki
Revision as of 05:15, 6 August 2008 by Compn (talk | contribs) (draft)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

bash script for playing youtube videos

usage: save it as youtube.sh chmod +x youtube.sh place it somewhere in PATH (like /usr/local/bin ) youtube.sh http://www.youtube.com/watch?v=example

#!/bin/bash

if [ -z "$1" ]; then echo "No URL!"; exit; fi

url=$1

echo \"http://www.youtube.com/get_video?video_id=`wget -q -O - $url | grep fullscreenUrl | awk
-F'video_id=' '{ print $2 }' | sed -e 's/ /_/g' | tr -d \'\; `\" | xargs mplayer -

created by enouf and n3kl