NS_PrimeWire_Hosters

Auto redirects to mp4 file on some of the video hosters used by primewire.ag

  1. // ==UserScript==
  2. // @name NS_PrimeWire_Hosters
  3. // @namespace mugPuke
  4. // @include http://daclips.com/*
  5. // @include http://daclips.in/*
  6. // @include http://gorillavid.com/*
  7. // @include http://gorillavid.in/*
  8. // @include http://movpod.in/*
  9. // @include http://movpod.net/*
  10. // @include http://streamin.to/*
  11. // @include http://streamplay.to/*
  12. // @include https://vidtodo.com/*
  13. // @include http://vidto.me/*
  14. // @include http://vidup.me/*
  15. // @include http://vidzi.tv/*
  16. // @description Auto redirects to mp4 file on some of the video hosters used by primewire.ag
  17. // @version 1
  18. // @grant none
  19. // ==/UserScript==
  20.  
  21. //
  22. // Unpacker for Dean Edward's p.a.c.k.e.r, a part of javascript beautifier
  23. // written by Einar Lielmanis <einar@jsbeautifier.org>
  24. //
  25. // Coincidentally, it can defeat a couple of other eval-based compressors.
  26. //
  27. // usage:
  28. //
  29. // if (P_A_C_K_E_R.detect(some_string)) {
  30. // var unpacked = P_A_C_K_E_R.unpack(some_string);
  31. // }
  32. //
  33. //
  34. var P_A_C_K_E_R = {
  35. detect: function(str) {
  36. return (P_A_C_K_E_R.get_chunks(str).length > 0);
  37. },
  38.  
  39. get_chunks: function(str) {
  40. var chunks = str.match(/eval\(\(?function\(.*?(,0,\{\}\)\)|split\('\|'\)\)\))($|\n)/g);
  41. return chunks ? chunks : [];
  42. },
  43.  
  44. unpack: function(str) {
  45. var chunks = P_A_C_K_E_R.get_chunks(str),
  46. chunk;
  47. for (var i = 0; i < chunks.length; i++) {
  48. chunk = chunks[i].replace(/\n$/, '');
  49. str = str.split(chunk).join(P_A_C_K_E_R.unpack_chunk(chunk));
  50. }
  51. return str;
  52. },
  53.  
  54. unpack_chunk: function(str) {
  55. var unpacked_source = '';
  56. var __eval = eval;
  57. if (P_A_C_K_E_R.detect(str)) {
  58. try {
  59. eval = function(s) { // jshint ignore:line
  60. unpacked_source += s;
  61. return unpacked_source;
  62. }; // jshint ignore:line
  63. __eval(str);
  64. if (typeof unpacked_source === 'string' && unpacked_source) {
  65. str = unpacked_source;
  66. }
  67. } catch (e) {
  68. // well, it failed. we'll just return the original, instead of crashing on user.
  69. }
  70. }
  71. eval = __eval; // jshint ignore:line
  72. return str;
  73. }
  74. };
  75.  
  76. //==============================================================================
  77.  
  78.  
  79. var SITES =
  80. {
  81. "vidtodo.com":{
  82. button_target: function() { return document.getElementById("btn_download"); },
  83. video_target: function() { return document.querySelector("#content ~ script"); },
  84. time: 2000,
  85. },
  86. "streamin.to":{
  87. button_target: function() { return document.getElementById("btn_download"); },
  88. video_target: function() { return document.querySelector("#rkm ~ script"); },
  89. time: 5000,
  90. },
  91. "movpod.net":{
  92. button_target: function() { return document.getElementById("btn_download"); },
  93. video_target: function() { return document.querySelector("#flvplayer ~ script"); },
  94. time: 1000,
  95. },
  96. "movpod.in":{
  97. button_target: function() { return document.getElementById("btn_download"); },
  98. video_target: function() { return document.querySelector("#flvplayer ~ script"); },
  99. time: 1000,
  100. },
  101. "gorillavid.com":{
  102. button_target: function() { return document.getElementById("btn_download"); },
  103. video_target: function() { return document.querySelector("#flvplayer ~ script"); },
  104. time: 1000,
  105. },
  106. "gorillavid.in":{
  107. button_target: function() { return document.getElementById("btn_download"); },
  108. video_target: function() { return document.querySelector("#flvplayer ~ script"); },
  109. time: 1000,
  110. },
  111. "daclips.in":{
  112. button_target: function() { return document.getElementById("btn_download"); },
  113. video_target: function() { return document.querySelector("#flvplayer ~ script"); },
  114. time: 1000,
  115. },
  116. "daclips.com":{
  117. button_target: function() { return document.getElementById("btn_download"); },
  118. video_target: function() { return document.querySelector("#flvplayer ~ script"); },
  119. time: 1000,
  120. },
  121. "vidzi.tv": {
  122. button_target: function() { return document.getElementById("vplayer_display_button_play"); },
  123. video_target: function() { return document.querySelectorAll("#embed-wrap ~ script")[3]; },
  124. time: 1000,
  125. },
  126. "vidtodo.com": {
  127. button_target: function() { return document.getElementById("btn_download"); },
  128. video_target: function() { return document.querySelectorAll("#content ~ script")[0]; },
  129. time: 1000,
  130. },
  131. "nosvideo.com": {
  132. button_target: function() { return document.getElementById("btn_download"); },
  133. video_target: function() { return document.querySelectorAll("div.video_zx_fadeinx ~ script")[0]; },
  134. time: 1000,
  135. },
  136. "streamplay.to": {
  137. button_target: function() { return document.getElementById("btn_download"); },
  138. video_target: function() { return document.querySelectorAll("#video-content ~ script")[0]; },
  139. time: 5000,
  140. },
  141. "vidto.me": {
  142. button_target: function() { return document.getElementById("btn_download"); },
  143. video_target: function() { return document.querySelectorAll("#player_code script")[2]; },
  144. time: 6000,
  145. },
  146. "thevideo.me": {
  147. button_target: function() {
  148. var form = document.getElementById("veriform");
  149. if( form == null ){ return null; }
  150. var input0 = document.createElement("input");
  151. input0.type = 'hidden';
  152. input0.id = 'gfk';
  153. input0.name = 'gfk';
  154. input0.value = 'i22abd2449';
  155.  
  156. var input1 = document.createElement("input");
  157. input1.type = 'hidden';
  158. input1.id = '_vhash';
  159. input1.name = '_vhash';
  160. input1.value = 'i1102394cE';
  161.  
  162. form.appendChild(input0);
  163. form.appendChild(input1);
  164. return document.getElementById("btn_download");
  165. },
  166. video_target: function() { return document.querySelectorAll("#page-content ~ script")[6]; },
  167. time: 1000,
  168. },
  169. "vidup.me": {
  170. button_target: function() {
  171. var form = document.getElementById("veriform");
  172. if( form == null ){ return null; }
  173. var input0 = document.createElement("input");
  174. input0.type = 'hidden';
  175. input0.id = 'gfk';
  176. input0.name = 'gfk';
  177. input0.value = 'i22abd2449';
  178.  
  179. var input1 = document.createElement("input");
  180. input1.type = 'hidden';
  181. input1.id = '_vhash';
  182. input1.name = '_vhash';
  183. input1.value = 'i1102394cE';
  184.  
  185. form.appendChild(input0);
  186. form.appendChild(input1);
  187. return document.getElementById("btn_download");
  188. },
  189. video_target: function() { return document.querySelectorAll("#page-content ~ script")[6]; },
  190. time: 1000,
  191. },
  192. "nosvideo.com": {
  193. button_target: function() { return document.getElementById("btn_download"); },
  194. video_target: function() { return document.querySelectorAll("div.video_zx_fadeinx ~ script")[0]; },
  195. time: 1000,
  196. },
  197. "noslocker.com": {
  198. button_target: function() { return document.getElementById("btn_download"); },
  199. video_target: function() { return document.querySelectorAll("#vplayer ~ script")[0]; },
  200. time: 1000,
  201. },
  202. };
  203.  
  204. var tld = window.location.host.split(".");
  205. var tld_string = (tld[tld.length-2]+"."+tld[tld.length-1]).toLowerCase();
  206.  
  207. function func() {
  208. var button_elem = SITES[tld_string].button_target();
  209. if(button_elem != null)
  210. {
  211. button_elem.click();
  212. }
  213. var video_elem = SITES[tld_string].video_target();
  214. if(video_elem == null) { return; }
  215. var url_regex = /(https?:\/\/)[^\s/$.?#].[^\s]*\.mp4/
  216. var str = video_elem.innerHTML;
  217. var matches = url_regex.exec(str);
  218. if(matches <= 2)
  219. {
  220. str = str.substr(str.indexOf("eval("));
  221. str = P_A_C_K_E_R.unpack(str);
  222. matches = url_regex.exec(str);
  223. if(matches <= 2){ return; }
  224. }
  225. var url = matches[0];
  226. document.getElementsByTagName("body")[0].innerHTML = "\
  227. <div id='player_code'>\
  228. <video autoplay='' style='width: 100%; height: 100%; display: block;' controls='controls' autobuffer='autobuffer' >\
  229. <source type='video/mp4' src='"+ url +"'>\
  230. <source type='.mp4' src='"+ url +"'>\
  231. <source type='.m4v' src='"+ url +"'>\
  232. </video>\
  233. </div>";
  234. window.location = url;
  235. }
  236.  
  237. document.addEventListener("DOMContentLoaded", setTimeout(func, SITES[tld_string].time), false);