1var links = new String();
2var downlink = new String();
3var has22 = new Boolean();
4has22 = false;
5var Marked = false;
6
7var FMT_DATA = fmt_url_map;//This is html text that you have to grab. In case of extension it was readily available through:document.getElementsByTagName('script');
8
9var StrSplitter1 = '%2C', StrSplitter2 = '%26', StrSplitter3 = '%3D';
10if (FMT_DATA.indexOf(',') > -1) { //Found ,
11 StrSplitter1 = ',';
12 StrSplitter2 = (FMT_DATA.indexOf('&') > -1) ? '&' : '\\u0026';
13 StrSplitter3 = '=';
14}
15
16var videoURL = new Array();
17var FMT_DATA_PACKET = new Array();
18var FMT_DATA_PACKET = FMT_DATA.split(StrSplitter1);
19
20for (var i = 0; i < FMT_DATA_PACKET.length; i++) {
21 var FMT_DATA_FRAME = FMT_DATA_PACKET[i].split(StrSplitter2);
22 var FMT_DATA_DUEO = new Array();
23
24 for (var j = 0; j < FMT_DATA_FRAME.length; j++) {
25 var pair = FMT_DATA_FRAME[j].split(StrSplitter3);
26 if (pair.length == 2) {
27 FMT_DATA_DUEO[pair[0]] = pair[1];
28 }
29 }
30
31 var url = (FMT_DATA_DUEO['url']) ? FMT_DATA_DUEO['url'] : null;
32
33 if (url == null) continue;
34 url = unescape(unescape(url)).replace(/\\\//g, '/').replace(/\\u0026/g, '&');
35 var itag = (FMT_DATA_DUEO['itag']) ? FMT_DATA_DUEO['itag'] : null;
36 var itag = (FMT_DATA_DUEO['itag']) ? FMT_DATA_DUEO['itag'] : null;
37 if (itag == null) continue;
38 var signature = (FMT_DATA_DUEO['sig']) ? FMT_DATA_DUEO['sig'] : null;
39 if (signature != null) {
40 url = url + "&signature=" + signature;
41 }
42 if (url.toLowerCase().indexOf('http') == 0) { // validate URL
43
44 if (itag == '5') {
45 links += '<a href="' + url + '&title=' + username + title + quality240 + '"style="text-decoration:none"><span class="yt-uix-button-menu-item" id="v240p">FLV (240p)</span></a>';
46 }
47 if (itag == '18') {
48 links += '<a href="' + url + '&title=' + username + title + quality360 + '"style="text-decoration:none"><span class="yt-uix-button-menu-item" id="v360p">MP4 (360p)</span></a>';
49 }
50 if (itag == '35') {
51 links += '<a href="' + url + '&title=' + username + title + quality480 + '"style="text-decoration:none"><span class="yt-uix-button-menu-item" id="v480p">FLV (480p)</span></a>';
52 }
53 if (itag == '22') {
54 links += '<a href="' + url + '&title=' + username + title + quality720 + '"style="text-decoration:none"><span class="yt-uix-button-menu-item" id="v720p">MP4 HD (720p)</span></a>';
55 }
56 if (itag == '37') {
57 links += ' <a href="' + url + '&title=' + username + title + quality1080 + '"style="text-decoration:none"><span class="yt-uix-button-menu-item" id="v1080p">MP4 HD (1080p)</span></a>';
58 }
59 if (itag == '38') {
60 links += '<a href="' + url + '&title=' + username + title + quality4k + '"style="text-decoration:none"><span class="yt-uix-button-menu-item" id="v4k">MP4 HD (4K)</span></a>';
61 }
62
63 FavVideo();
64 videoURL[itag] = url;
65 console.log(itag);
66 }
67}
68