AlioNiroti

Untitled

Aug 24th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.53 KB | None | 0 0
  1. replaceAll = function(input,stringToFind,stringToReplaceWith){myRegExp=new RegExp(stringToFind, 'g');return input.replace(myRegExp, stringToReplaceWith);};
  2. setDiv = function(videos){
  3. var title = 'saved video';
  4. var titleH1 = document.getElementById('watch-headline-title');
  5. if(titleH1 != null){
  6. title = titleH1.children[0].innerText;
  7. }
  8. var html = '<div id="download-youtube-chrome-extension" class="yt-card yt-card-has-padding">';
  9. html = html + '<div style="font-weight: bold; padding: 5px; border-bottom: 1px solid #CCC;">Click on the format to save the video as:</div>';
  10. html = html + '<div style="padding: 5px; font-weight: bold;">';
  11. var counter = 0;
  12. for(i in videos){
  13. var video = videos[i];
  14. if(video.url != '' && video.url.indexOf('http') == 0){
  15. if(counter != 0) html = html + ' | ';
  16. if(typeof video.formatObject == 'undefined'){
  17. html = html + '<span><a href="' + video.url + '&title='+replaceAll(title,'"','%22')+'" onclick="_gaq.push([\'_trackEvent\', \'Download\', \'' + replaceAll(replaceAll(title,'"','&quot;'), '\'', '\\\'') + '\', \'Unknown Format\']);">Unknown Format</a></span>';
  18. }else{
  19. html = html + '<span><a href="' + video.url + '&title='+replaceAll(title,'"','%22')+' [' + video.formatObject.resolution + 'p]" onclick="_gaq.push([\'_trackEvent\', \'Download\', \'' + replaceAll(replaceAll(title,'"','&quot;'), '\'', '\\\'') + '\', \'' + video.formatObject.format + ' ' + video.formatObject.resolution + 'p\']);">' + video.formatObject.resolution + 'p ' + video.formatObject.format + '</a></span>';
  20. }
  21. counter++;
  22. }
  23. }
  24. html = html + ' | <a onclick="_gaq.push([\'_trackEvent\', \'Ringtone\', \'Click\', \''+replaceAll(title,'"','&quot;')+'\']);" href="http://www.ringtonematcher.com/go/?sid=DYTVros&search='+replaceAll(title.replace(/[-]/ig,''),'"','&quot;')+'" target="_blank">Phone Ringtone</a>';
  25. html = html + '</div>';
  26. // html = html + '<div style="padding: 5px; font-weight: bold">&gt;&gt; <a onclick="_gaq.push([\'_trackEvent\', \'Ringtone\', \'Click\', \''+replaceAll(title,'"','&quot;')+'\']);" href="http://www.ringtonematcher.com/go/?sid=DYTVros&search='+replaceAll(title.replace(/[-]/ig,''),'"','&quot;')+'" target="_blank">Download &quot;'+replaceAll(title,'"','&quot;')+'&quot; ringtone to your phone</a> &lt;&lt;</div>';
  27. // html = html + '<div style="padding: 5px;">';
  28. // html = html + '<div id="download-youtube-chrome-ad-620-60"><IFRAME FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=620 HEIGHT=60 SRC="https://s3.amazonaws.com/download-youtube-chrome/ads-iframe.html?ref='+encodeURIComponent(document.referrer)+'&url='+encodeURIComponent(document.location.href)+'"></IFRAME></div>';
  29. // html = html + '<div id="download-youtube-chrome-ad-620-60"><iframe src="https://rcm-na.amazon-adsystem.com/e/cm?t=downyoutvide-20&o=1&p=13&l=ur1&category=gift_certificates&banner=180TQ0K9X17QCCZQS4R2&f=ifr&linkID=674XWND6QSJYZFMT" width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe></div>';
  30. // html = html + '<div id="download-youtube-chrome-ad-620-60"><IFRAME SRC="https://ib.adnxs.com/tt?id=3990674&referrer=[REFERRER_URL]" FRAMEBORDER="0" SCROLLING="no" MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0" LEFTMARGIN="0" ALLOWTRANSPARENCY="true" WIDTH="468" HEIGHT="60"></IFRAME></div>';
  31. // html = html + "<iframe src='https://yepdigital.adk2.co/yepdigital/scripts/direct/direct.html?a=61881795&secure=true&size=468x60&ci=1&serverdomain=ads.adservhere.com&context=c62081709' height='60' width='468' frameborder='0' border='0' marginwidth='0' marginheight='0' scrolling='no'></iframe>";
  32. // html = html + '</div>';
  33. html = html + '<div style="padding: 5px;">';
  34. html = html + 'By <a href="http://www.downloadyoutubechrome.com/">Download Youtube Chrome</a> version 2.0 (<a href="http://www.downloadyoutubechrome.com/latest-version.php">Check New Version</a>)';
  35. html = html + ' | <a href="http://www.downloadyoutubechrome.com/feedback.php">Feedback</a>';
  36. html = html + ' | <a href="https://eltima.cleverbridge.com/389/uurl-o2pt0a1798" target="_blank">Download Elmedia Player</a>';
  37. html = html + '</div>';
  38. html = html + '</div>';
  39. var wpDiv = document.getElementById('watch7-content');
  40. if(wpDiv != null){
  41. wpDiv.innerHTML = html + wpDiv.innerHTML;
  42. var sideAdDiv = document.getElementById('watch7-sidebar-contents');
  43. if(sideAdDiv != null){
  44. var html ="";
  45. html = "<iframe src='https://152media.adk2.co/152media/tags/xdirect/xdirect.html?p=70255552&serverdomain=152media&size=300x250&secure=true&ct=html&ap=1300' height='250' width='300' frameborder='0' border='0' marginwidth='0' marginheight='0' scrolling='no'></iframe>";
  46. //var html = "<iframe src='http://cdn.offersquared.com/152media/tags/xdirect/xdirect.html?p=70255552&serverdomain=152media&size=300x250&ct=html&ap=1300' height='250' width='300' frameborder='0' border='0' marginwidth='0' marginheight='0' scrolling='no'></iframe>";
  47. //var html = '<iframe src="https://ad131m.adk2.co/ad131m/scripts/direct/direct.html?a=11841112&secure=true&size=300x250&ci=1&serverdomain=s.ad131m.com&context=c55452061" height="250" width="300" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';
  48. //var html = "<iframe src='https://yepdigital.adk2.co/yepdigital/scripts/direct/direct.html?a=61881795&secure=true&size=300x250&ci=1&serverdomain=ads.adservhere.com&context=c62081709' height='250' width='300' frameborder='0' border='0' marginwidth='0' marginheight='0' scrolling='no'></iframe>";
  49. //var html = "<iframe src='https://ib.adnxs.com/tt?id=3988224&referrer=[REFERRER_URL]' height='250' width='300' frameborder='0' border='0' marginwidth='0' marginheight='0' scrolling='no'></iframe>";
  50. sideAdDiv.innerHTML = html + sideAdDiv.innerHTML;
  51. }
  52. }
  53. _gaq.push(['_trackPageview']);
  54. }
  55. getVideos = function(){
  56. try{
  57. var formats = {
  58. 5: { itag: 5, resolution: 224, format: "FLV"},
  59. 6: { itag: 6, resolution: 270, format: "FLV"},
  60. 13: { itag: 13, resolution: 144, format: "3GP"},
  61. 17: { itag: 17, resolution: 144, format: "3GP"},
  62. 18: { itag: 18, resolution: 360, format: "MP4"},
  63. 22: { itag: 22, resolution: 720, format: "MP4"},
  64. 34: { itag: 34, resolution: 360, format: "FLV"},
  65. 35: { itag: 35, resolution: 480, format: "FLV"},
  66. 36: { itag: 36, resolution: 240, format: "3GP"},
  67. 37: { itag: 37, resolution: 1080, format: "MP4"},
  68. 38: { itag: 38, resolution: 2304, format: "MP4"},
  69. 43: { itag: 43, resolution: 360, format: "WebM"},
  70. 44: { itag: 44, resolution: 480, format: "WebM"},
  71. 45: { itag: 45, resolution: 720, format: "WebM"},
  72. 46: { itag: 46, resolution: 1080, format: "WebM"},
  73. 82: { itag: 82, resolution: 360, format: "MP4"},
  74. 83: { itag: 83, resolution: 240, format: "MP4"},
  75. 84: { itag: 84, resolution: 1080, format: "MP4"},
  76. 85: { itag: 85, resolution: 520, format: "MP4"},
  77. 100:{ itag: 100, resolution: 360, format: "WebM"},
  78. 101:{ itag: 101, resolution: 480, format: "WebM"},
  79. 102:{ itag: 102, resolution: 720, format: "WebM"},
  80. 103:{ itag: 103, resolution: 480, format: "AVI"},
  81. 104:{ itag: 104, resolution: 720, format: "AVI"},
  82. 105:{ itag: 105, resolution: 1080, format: "AVI"},
  83. 106:{ itag: 106, resolution: 2304, format: "AVI"}
  84. };
  85. var videos = new Array();
  86. var flashVarsString = ytplayer.config.args.url_encoded_fmt_stream_map;
  87. var streamFiles = flashVarsString.split(',');
  88. for(i in streamFiles){
  89. streamData = streamFiles[i].split('&');
  90. var url = '';
  91. var sig = '';
  92. var itag = 0;
  93. for(y in streamData){
  94. if(streamData[y].indexOf('itag=') == 0){
  95. itagData = streamData[y].split('=');
  96. itag = itagData[1];
  97. }
  98. if(streamData[y].indexOf('url=') == 0){
  99. urlData = streamData[y].split('=');
  100. url = unescape(urlData[1]);
  101. }
  102. if(streamData[y].indexOf('s=') == 0){
  103. sigData = streamData[y].split('=');
  104. sig = unescape(sigData[1]);
  105. }
  106.  
  107. }
  108. if(url != '' && itag != 0){
  109. if(url.indexOf('signature') > 0){
  110. var video = {formatObject: formats[itag], url: url};
  111. videos.push(video);
  112. }else{
  113. var video = {formatObject: formats[itag], url: url+'&signature='+crack_signature(sig)};
  114. videos.push(video);
  115. }
  116. }
  117. }
  118. return videos;
  119. }catch(err){
  120. var videos = new Array();
  121. console.log(err);
  122. return videos;
  123. }
  124. }
  125. crack_signature = function(signature) {
  126. a = signature.split("");
  127. voodoo.kR(a, 3);
  128. voodoo.sI(a, 44);
  129. voodoo.kR(a, 1);
  130. voodoo.nV(a, 55);
  131. voodoo.kR(a, 1);
  132. voodoo.nV(a, 34);
  133. voodoo.kR(a, 3);
  134. voodoo.nV(a, 17);
  135. voodoo.kR(a, 3);
  136. return a.join("")
  137. }
  138. var voodoo = {
  139. sI: function(a, b) {
  140. var c = a[0];
  141. a[0] = a[b % a.length];
  142. a[b] = c
  143. },
  144. kR: function(a, b) {
  145. a.splice(0, b)
  146. },
  147. nV: function(a) {
  148. a.reverse()
  149. }
  150. };
  151. listener = function(){
  152. var ext = document.getElementById('download-youtube-chrome-extension');
  153. if(typeof ytplayer != 'undefined' &&
  154. typeof ytplayer.config != 'undefined' &&
  155. ytplayer.config != null &&
  156. typeof ytplayer.config.args != 'undefined' &&
  157. typeof ytplayer.config.args.url_encoded_fmt_stream_map != 'undefined' &&
  158. ext == null){
  159. setDiv(getVideos());
  160. }
  161. }
  162. if(window.history && history.pushState){
  163. setInterval("listener()", 300);
  164. }else{
  165. setDiv(getVideos());
  166. }
  167. // ga tracking
  168. var _gaq = _gaq || [];
  169. _gaq.push(['_setAccount', 'UA-28955501-2']);
  170. _gaq.push(['_setDomainName', 'youtube.com']);
  171. (function() {
  172. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  173. ga.src = 'https://ssl.google-analytics.com/ga.js';
  174. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  175. })();
Advertisement
Add Comment
Please, Sign In to add comment