HOWTO play YouTube files directly in VLC
(I'm adding this very basic info to this thread because it came up as the first Google hit for "play youtube with vlc", but the thread doesn't yet contain the actual solution. Apparently (
viewtopic.php?f=16&t=43711) VLC 0.9 supports this functionality natively; the below has been tested with 0.8.6d and 0.8.6e)
You *can* play files directly from YouTube via VLC; there is no need to transcode the file or use any of the specialized services and tools. It's just a matter of crafting the correct URL. There are several redirects from said properly-crafted URL to the actual file contents, but VLC follows them correctly and transparently.
A caveat: pause, rewind and fast-forward don't seem to work correctly (and really, I would be pretty surprised if they did).
The format of the URL that you need in order to directly access a video is this:
http://www.youtube.com/get_video?video_ ... &sk=SK&t=T
The three values you need from the actual YouTube page are VIDEO_ID, SK and T. All three values are stored in the swfArgs variable: yippee! That makes the values really easy to reach! This little code snippet here will pop up an alert box with the proper values stuffed into the proper slots:
Code: Select all
javascript:alert("http://www.youtube.com/get_video?video_id=" + swfArgs.video_id + "&sk=" + swfArgs.sk + "&t=" + swfArgs.t)
...and this'll do the same thing in a slightly more structured fashion, if that kind of thing floats your boat:
Code: Select all
javascript:alert((new String("http://www.youtube.com/get_video?video_id=%s&sk=%s&t=%s")).replace(/%s/, swfArgs.video_id).replace(/%s/, swfArgs.sk).replace(/%s/, swfArgs.t))
Pop the generated URL directly into VLC's "Open Network Stream - HTTP/HTTPS/FTP/MSS" dialog and hit play.