//View Tip #701
» Remove comments and blank lines
» Mass-renaming files
» Print part of a file
» MAC address conversion
alper
Similar Tips
» BBC Weather» Remove comments and blank lines
» Mass-renaming files
» Print part of a file
» MAC address conversion

Latest tips by RSS
Click here to subscribe

Follow Shell-Fu on Twitter
Click here to follow

Follow Shell-Fu on identi.ca
Click here to follow
YouTube is great, but the embedded flash player doesn't offer a lot in the way of customizing your viewing experience. There are quite a few options for downloading flv video files from YouTube, but adding the following function to your bashrc will let you stream them directly to your choice of media player.
This should work with any URL of the form http://www.youtube.com/watch?v=[video id here], for example:
function mtube { video_id=$(curl -s $1 | sed -n "/watch_fullscreen/s;.*\(video_id.\+\)&title.*;\1;p"); mplayer -fs $(echo "http://youtube.com/get_video.php?$video_id"); }
This should work with any URL of the form http://www.youtube.com/watch?v=[video id here], for example:
mtube http://www.youtube.com/watch?v=evQ0QNi2CzA
Comments
Add your comment
Comments are currently disabled
#1
mplayer opens and shows the first frame of the movies but does not play. does this require a specific plug-in or package to be installed?
Posted 2009-04-20 17:27:50
Great function :)
if wanting to use wget instead of curl, try
"wget -O - $1" in the script above.
if wanting to use wget instead of curl, try
"wget -O - $1" in the script above.
Posted 2009-04-20 19:57:50
According to Synaptic Package Manager,
mplayer isn't supported by Ubuntu.
mplayer isn't supported by Ubuntu.
Posted 2009-04-22 04:09:56