bkerley (owner)

Revisions

gist: 61728 Download_button fork
public
Public Clone URL: git://gist.github.com/61728.git
Embed All Files: show embed
youtubeqt.user.js #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// ==UserScript==
// @name Youtube QT
// @namespace userscripts.org
// @description Plays the high-resolution YouTube video in an embedded Quicktime player
// @version 0.1
// @include http://youtube.com/watch?*
// @include http://www.youtube.com/watch?*
// @include http://*.youtube.com/watch?*
// ==/UserScript==
 
var video_id = null;
var video_hash = null;
var video_player = document.getElementById('movie_player');
 
if (video_player) {var flash_variables=video_player.attributes.getNamedItem('flashvars');
if (flash_variables) {var flash_values=flash_variables.value;
if (flash_values) {var video_id_match=flash_values.match(/video_id=([^(\&|$)]*)/);
if (video_id_match!=null) video_id=video_id_match[1];
var video_hash_match=flash_values.match(/t=([^(\&|$)]*)/);
if (video_hash_match!=null) video_hash=video_hash_match[1];
}
}
}
 
if (video_id==null || video_hash==null) {var args=unsafeWindow.swfArgs;
if (args) {video_id=args['video_id'];
video_hash=args['t'];
}
}
 
if (video_id==null || video_hash==null) return;
var fmt_segment = 'fmt_map='+swfArgs['fmt_map'];
if (isHDAvailable) {
    fmt_segment = 'fmt=22';
}
var yt_mp4_path = 'http://www.youtube.com/get_video?'+fmt_segment+'&video_id='+video_id+'&t='+video_hash;
var div_embed=document.getElementById('watch-player-div');
 
if (div_embed) {
    div_embed.innerHTML='<embed src=\''+yt_mp4_path+'\' type="video/mp4" width=854 height=504 scale=\'aspect\'></embed>';
    toggleWidePlayer(true);
};