connecting youtube with mplayer via bookmarklet

Replies:

  • None.

Parents:

  • None.
Because Flash is a buggy piece of junk (especially on Linux), I
avoid using it whenever possible in my browser, thanks to the
Flashblock add-on for firefox.

To watch Youtube videos I use this bookmarklet [1] to download
the video file in the highest resolution possible and save it as
an mp4 file in my /tmp/ directory. Sometimes I then rename and
move my favorites to a separate directory so I can watch them
when offline, copy them to the media player attached to my TV,
etc. (for that I use a WD TV [2]: a simple linux appliance that
plays media from whatever devices you connect to it via USB. Its
UI isn't the prettiest but it's much cheaper and overall much
better than the Sony PS3 I bought for that purpose before.)

I recently made a trivial little shell script that plays the most
recently-downloaded video from my temp directory, and hooked it
up to an app launcher on my desktop panel (with a youtube icon)

   #!/bin/sh
   mplayer -fs `ls -1art /tmp/video*mp4* | tail -1`

These two trivial little things let me watch youtube videos with
my media player of choice, fullscreen and randomly-seekable, with
only two mouseclicks and without having to run Flash.

(I showed this to someone at a meeting a couple days ago, and
said I would email details)

[1] youtube download bookmarklet: this needs to be updated every
   few months whenever youtube changes things; I just google for
   'youtube download bookmarklet' whenever it stops working.

   javascript:var%20video_id=null;var%20video_hash=null;var%20video_player=document.getElementById('movie_player');if(video_player){var%20flash_variables=video_player.attributes.getNamedItem('flashvars');if(flash_variables){var%20flash_values=flash_variables.value;if(flash_values){var%20video_id_match=flash_values.match(/[^a-z]video_id=([^(\&|$)]*)/);if(video_id_match!=null)video_id=video_id_match[1];var%20video_hash_match=flash_values.match(/[^a-z]t=([^(\&|$)]*)/);if(video_hash_match!=null)video_hash=video_hash_match[1]}}}if(video_id==null||video_hash==null){var%20args=null;try{args=yt.getConfig('SWF_ARGS')}catch(e){}if(args){video_id=args['video_id'];video_hash=args['t']}}if(video_id!=null&&video_hash!=null){var%20fmt='18';try{if(yt.getConfig('IS_HD_AVAILABLE'))fmt='22'}catch(e){}document.location.href='http://www.youtube.com/get_video?fmt='+fmt+'&video_id='+video_id+'&t='+video_hash}


[2] http://www.amazon.com/Western-Digital-WD-Media-Player/dp/B001JZFQU4/geraldoskoboiny

--
Gerald Oskoboiny <[email protected]>
http://impressive.net/people/gerald/

HURL: fogo mailing list archives, maintained by Gerald Oskoboiny