Fabianegg

Untitled

Feb 26th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.97 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Skrypt umożliwiający pobieranie materiałów ze znanych serwisów VOD.
  3. // @namespace http://www.ipla.tv/
  4. // @include *www.ipla.tv/*
  5. // @include *getmedia.redefine.pl/*
  6. // @include *player.pl/*
  7. // @include *vod.pl/*
  8. // @include *qi.ckm.onetapi.pl/*
  9. // @include *tvp.pl/*
  10. // @include *www.cda.pl/*
  11. // @version 4.9
  12. // @description Skrypt umożliwiający pobieranie materiałów z serwisów: ipla.tv, player.pl, vod.pl, vod.tvp.pl, cda.pl. Działa tylko z rozszerzeniem Tampermonkey.
  13. // @author Przemek
  14. // @match http://www.ipla.tv/*
  15. // @grant none
  16. // ==/UserScript==
  17. //Ważne:
  18. //Skrypt opiera się na skryptach umieszczonych na stronie: miniskrypt.blogspot.com
  19. //oraz: miniskrypt.hubaiitv.pl. Moje rozszerzenie tylko i wyłącznie dodaje wygodne
  20. //w użyciu przyciski, jednak nie jestem autorem większości kodu.
  21. //Skrypt jest niepubliczny, a dostęp do niego mają tylko i wyłącznie osoby z linkiem.
  22. /////////////////////// KONFIGURACJA ////////////////////////
  23. var Wlacz_skrypt = true; // true = skrypt włączony, false = skrypt wyłączony.
  24. //////////////////// KONIEC KONFIGURACJI ////////////////////
  25.  
  26. var SkryptKopiujText = "function copyText(e){function t(e){if(document.selection){var t=document.body.createTextRange();t.moveToElementText(e),t.select()}else if(window.getSelection){var t=document.createRange();t.selectNode(e),window.getSelection().removeAllRanges(),window.getSelection().addRange(t)}}var n=document.createElement(\"DIV\");n.textContent=e,document.body.appendChild(n),t(n),document.execCommand(\"copy\"),n.remove()} ";
  27. var StyleText = "<style>body{font-family: \"Segoe UI\";}.clicked{background-color: #7CFC00;}</style>";
  28.  
  29. function addEvent(obj, event, func) {
  30. if (obj.addEventListener) {
  31. obj.addEventListener(event, func, false);
  32. return true;
  33. } else if (obj.attachEvent) {
  34. obj.attachEvent('on' + event, func);
  35. } else {
  36. var f = obj['on' + event];
  37. obj['on' + event] = typeof f === 'function' ? function () {
  38. f();
  39. func();
  40. }
  41. : func;
  42. }
  43. }
  44.  
  45. function ShowPromptWithInfo(lol, info = null) {
  46. var infotext = 'Aby skopiować link, wciśnij: CTRL+C, potem: ENTER aby rozpocząć pobieranie, lub ESC aby zakończyć działanie skryptu';
  47. if(info !== null){
  48. infotext = infotext + ". " + info;
  49. }
  50. if (window.prompt(infotext, lol)) {
  51. document.location.href = lol;
  52. }
  53. }
  54.  
  55. function ShowPrompt(lol) {
  56. window.prompt('Aby skopiować link, wciśnij: CTRL+C, potem: ENTER', lol);
  57. }
  58.  
  59. function makeid()
  60. {
  61. var text = '';
  62. var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  63. for (var i = 0; i < 5; i++)
  64. text += possible.charAt(Math.floor(Math.random() * possible.length));
  65. return text;
  66. }
  67.  
  68. var DocumentWriteFirefoxFix = '';
  69. function fireNewTab() {
  70. function makeid2() {
  71. var text = '';
  72. var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  73. for (var i = 0; i < 5; i++)
  74. text += possible.charAt(Math.floor(Math.random() * possible.length));
  75. return text;
  76. }
  77. var randomText = makeid2();
  78. var newTab = window.open('about:blank', 'MsgWindow-' + randomText);
  79. newTab.document.write("DocumentWriteFirefoxFix");
  80. newTab.addEventListener('load', function () {
  81. //alert('hi2');
  82. var destDoc = newTab.document;
  83. destDoc.open();
  84. destDoc.write("DocumentWriteFirefoxFix");
  85. destDoc.close();
  86. }, false
  87. );
  88. }
  89. function addslashes( str ) {
  90. return (str + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0');
  91. }
  92.  
  93. function addJS_Node(text, s_URL, funcToRun, runOnLoad) {
  94. var D = document;
  95. var scriptNode = D.createElement('script');
  96. if (runOnLoad) {
  97. scriptNode.addEventListener('load', runOnLoad, false);
  98. }
  99. scriptNode.type = 'text/javascript';
  100. if (text) scriptNode.textContent = text;
  101. if (s_URL) scriptNode.src = s_URL;
  102. var str = funcToRun.toString();
  103. var tes = addslashes(DocumentWriteFirefoxFix);
  104. var res = str.replace("DocumentWriteFirefoxFix", tes);
  105. res = res.replace("DocumentWriteFirefoxFix", tes);
  106. if (funcToRun) scriptNode.textContent = '(' + res + ')()';
  107.  
  108. var targ = D.getElementsByTagName('head') [0] || D.body || D.documentElement;
  109. targ.appendChild(scriptNode);
  110. }
  111.  
  112. function PokazLinkTVNNowy() {
  113. try {
  114. try {
  115. n = document.querySelector("#detailEpisode").getAttribute("data-article-id");
  116. } catch (e) {
  117. var pageURL = window.location.href;
  118. var lastComma = pageURL.lastIndexOf(",");
  119. if (lastComma > - 1) {
  120. n = pageURL.substring(lastComma+1);
  121. n = parseInt(n);
  122. }
  123. }
  124. xmlhttp = new XMLHttpRequest();
  125. xmlhttp.open("GET", "/api/?platform=ConnectedTV&terminal=Panasonic&format=json&authKey=064fda5ab26dc1dd936f5c6e84b7d3c2&v=3.1&m=getItem&id=" + n, false);
  126. xmlhttp.send();
  127. o = JSON.parse(xmlhttp.responseText);
  128. lt = o.item.videos.main.video_content_license_type;
  129. dd = o.item.videos.main.video_content;
  130. title = o.item.serie_title + " - S" + o.item.season + "E" + o.item.episode;
  131. if (lt !== null) {
  132. alert('DRM lub brak materiału TV :(');
  133. return;
  134. }
  135. DocumentWriteFirefoxFix = "";
  136. var randomText = makeid();
  137. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + '<p>Tytuł: ' + title + '</p>';
  138. var HighestResolution = 0;
  139. var HighestResolutionLink = '';
  140. for (var j = 0, len = dd.length; j < len; j = j + 1) {
  141. HighestResolution = HighestResolution + 1;
  142. dlurl = dd[j].url;
  143. if(j < 2){
  144. HighestResolutionLink = dlurl;
  145. }
  146. pn = dd[j].profile_name;
  147. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + "<p>Jakość materiału: " + pn + "<br>";
  148. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + "Link do materiału: <button id=\"button-" + j + "\" type=\"button\">Kopiuj</button><br><a target=\"_blank\" href=\"" + dlurl + "\">" + dlurl + "</a></p>";
  149. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + "<script>var but = document.getElementById('button-"+j+"');but.addEventListener('click', function(){copyText(\""+ dlurl +"\");document.getElementById('button-"+j+"').setAttribute(\"class\", \"clicked\");})</script>";
  150. }
  151. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + StyleText + '<script type="application/javascript">function ShowPromptWithInfo(lol){if (window.prompt("Aby skopiować link, wciśnij: CTRL+C, potem: ENTER aby rozpocząć pobieranie, lub ESC aby zakończyć działanie skryptu", lol)){document.location.href=lol;}}setTimeout(function () {ShowPromptWithInfo("' + HighestResolutionLink + '");}, 1000);' + SkryptKopiujText + '</script>';
  152. addJS_Node(null, null, fireNewTab);
  153.  
  154. } catch (e) {}
  155. }
  156.  
  157. function PokazLinkPobieranieIpla() {
  158. //alert('ipla');
  159. nn = document.querySelector('pre').textContent;
  160. v = JSON.parse(nn);
  161. if (v.vod.drm == true) {
  162. alert('Niestety, ale materiał jest zabezpieczony DRM i prawdopodobnie nie będzie można go pobrać :(');
  163. }
  164. var QualityArray = [];
  165. var copies = v.vod.copies;
  166. if(copies !== null){
  167. if(copies.length > 0){
  168. for (var prop in copies) {
  169. var copy = copies[prop];
  170. var newArray = [copy.quality_p, copy.url];
  171. QualityArray.push(newArray);
  172. }
  173. if(QualityArray !== null){
  174. var countArray = QualityArray.length;
  175. if(countArray > 0){
  176. var countArrayElement = countArray - 1;
  177. var bestQuality = QualityArray[countArrayElement][0];
  178. var bestQualityLink = QualityArray[countArrayElement][1];
  179. ShowPromptWithInfo(bestQualityLink,"\nWybrana jakość materiału to: " + bestQuality + ".");
  180. }
  181. }
  182. }
  183. }
  184. }
  185.  
  186. function PokazLinkIpla() {
  187. if (location.href.match(/^http[s]?:\/\/www\.ipla\.tv\//)) {
  188. try {
  189. var mid = document.querySelector('#vod-player').getAttribute('data-vod-json');
  190. var idn = JSON.parse(mid).mid;
  191. //top.location.href = 'https://getmedia.redefine.pl/vods/get_vod/?cpid=1&ua=mipla_ios/122&media_id=' + idn;
  192. top.location.href = 'https://getmedia.redefine.pl/vods/get_vod/?cpid=1&ua=www_iplatv_html5/12345&media_id=' + idn;
  193. } catch (e) {
  194.  
  195. try {
  196. var x = window.location.href;
  197. idn = x.match(/[\a-z\d]{32}/)[0];
  198. //top.location.href = 'https://getmedia.redefine.pl/vods/get_vod/?cpid=1&ua=mipla_ios/122&media_id=' + idn;
  199. top.location.href = 'https://getmedia.redefine.pl/vods/get_vod/?cpid=1&ua=www_iplatv_html5/12345&media_id=' + idn;
  200. } catch (e) {
  201. var pageURL = window.location.href.split("?")[0];
  202. var pageURLTemp = pageURL.substring(0, pageURL.length - 3);
  203. var lastComma = pageURLTemp.lastIndexOf("/");
  204. if (lastComma > - 1) {
  205. var n = pageURL.substring(lastComma+1);
  206. mid = n;
  207. //document.location.href = 'http://getmedia.redefine.pl/vods/get_vod/?cpid=1&ua=mipla_ios/122&media_id=' + mid;
  208. document.location.href = 'http://getmedia.redefine.pl/vods/get_vod/?cpid=1&ua=www_iplatv_html5/12345&media_id=' + mid;
  209. }
  210. }
  211. }
  212. }
  213. }
  214. function PokazLinkOnet() {
  215. try{
  216. i = document.querySelector(".mvp").getAttribute('id');
  217. m = i.match(/mvp:(.+)/)[1];
  218. i = document.body.innerHTML;
  219. title = i.match(/title: \'(.*)\',/)[1];
  220. url = "aHR0cHM6Ly9wbGF5ZXItYXBpLmRyZWFtbGFiLnBsLz9ib2R5W2lkXT0rbSsmYm9keVtqc29ucnBjXT0yLjAmYm9keVttZXRob2RdPWdldF9hc3NldF9kZXRhaWwmYm9keVtwYXJhbXNdW0lEX1B1Ymxpa2FjamldPSttKyZib2R5W3BhcmFtc11bU2VydmljZV09dm9kLm9uZXQucGwmY29udGVudC10eXBlPWFwcGxpY2F0aW9uL2pzb25wJngtb25ldC1hcHA9cGxheWVyLmZyb250Lm9uZXRhcGkucGwmY2FsbGJhY2s9";
  221. url = (atob(url)).replace(/\+m\+/g, m);
  222. xhr = new XMLHttpRequest();
  223. xhr.open('GET', url, false);
  224. xhr.send(null);
  225. v = JSON.parse(xhr.responseText);
  226. vc = v.result[0].formats.wideo["mp4-uhd"];
  227. if (!vc) {
  228. alert('Niestety, ale materiał jest zabezpieczony DRM i nie będzie można go pobrać :(');
  229. return;
  230. };
  231. title = v.result[0].meta.title;
  232. for (var i = -1, cc = [], dd = [], l = vc.length >>> 0; ++i !== l; null) {
  233. dd[i] = cc[i] = vc[i].video_bitrate;
  234. };
  235. dd.sort(function (a, b) {
  236. return b - a;
  237. });
  238. //pagecreate(title);
  239. DocumentWriteFirefoxFix = "";
  240. var randomText = makeid();
  241. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + '<p>Tytuł: ' + title + '</p>';
  242. var HighestResolution = 0;
  243. var HighestResolutionLink = '';
  244. for (var j = 0, len = dd.length; j < len; j = j + 1) {
  245. dlurl = vc[cc.indexOf(dd[j])].url;
  246. bitrate = vc[cc.indexOf(dd[j])].video_bitrate;
  247. vertical_resolution = vc[cc.indexOf(dd[j])].vertical_resolution;
  248. /*container.appendChild(createNode("pre", {}, {
  249. textContent: "Bitrate: " + bitrate + " - Rozdzielczość pionowa: " + vertical_resolution
  250. }));
  251. w = 'wget --restrict-file-names=windows --progress=bar --header="User-Agent:ABC" -c -O "' + title + '.mp4" ' + dlurl;
  252. buttoncreate(dlurl, title, w);*/
  253. if (vertical_resolution > HighestResolution) {
  254. HighestResolution = vertical_resolution;
  255. HighestResolutionLink = dlurl;
  256. }
  257. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + '<p>Bitrate: ' + bitrate + ' - Rozdzielczość pionowa: ' + vertical_resolution + '<br>';
  258. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + "Link do materiału: <button id=\"button-" + j + "\" type=\"button\">Kopiuj</button><br><a target=\"_blank\" href=\"" + dlurl + "\">" + dlurl + "</a></p>";
  259. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + "<script>var but = document.getElementById('button-"+j+"');but.addEventListener('click', function(){copyText(\""+ dlurl +"\");document.getElementById('button-"+j+"').setAttribute(\"class\", \"clicked\");})</script>";
  260. }
  261. if (HighestResolution > 0) {
  262. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + StyleText + '<script type="application/javascript">function ShowPromptWithInfo(lol){if (window.prompt("Aby skopiować link, wciśnij: CTRL+C, potem: ENTER aby rozpocząć pobieranie, lub ESC aby zakończyć działanie skryptu", lol)){document.location.href=lol;}}setTimeout(function () {ShowPromptWithInfo("' + HighestResolutionLink + '");}, 1000);' + SkryptKopiujText + '</script>';
  263. addJS_Node(null, null, fireNewTab);
  264. }
  265. }
  266. catch (e){
  267. if (location.href.match(/^http[s]?:\/\/vod\.pl\//) || location.href.match(/^http[s]?:\/\/bajki\.onet\.pl\//)) {
  268. var i = document.body.innerHTML;
  269. m = i.match(/mvp:([\d\.]+)\x22/);
  270. var url = "http://qi.ckm.onetapi.pl/?body[id]=22D4B3BC014A3C200BCA14CDFF3AC018&body[jsonrpc]=2.0&body[method]=get_asset_detail&body[params][ID_Publikacji]=" + m[1] + "&body[params][Service]=vod.onet.pl&content-type=application/jsonp&x-onet-app=player.front.onetapi.pl&_=1487536996333";
  271. document.location.href = url;
  272. } else if (location.href.match(/^http?:\/\/qi\.ckm.\onetapi\.pl\//)) {
  273. nn = document.querySelector("pre").textContent;
  274. v = JSON.parse(nn);
  275. vc = v.result[0].formats.wideo.mp4;
  276. for (var i = -1, cc = [], dd = [], l = vc.length >>> 0; ++i !== l; null) {
  277. dd[i] = cc[i] = vc[i].video_bitrate;
  278. };
  279. dd.sort(function(a, b) {
  280. return b - a;
  281. });
  282. for (var j = 0, len = dd.length; j < len; j = j + 1) {
  283. var dlurl = vc[cc.indexOf(dd[j])].url;
  284. if (dlurl !== undefined) {
  285. break;
  286. break;
  287. }
  288. };
  289. document.location.href = dlurl;
  290. }
  291. }
  292. }
  293.  
  294. function PokazLinkOnetOld() {
  295. try{
  296. i = document.body.innerHTML;
  297. m = i.match(/mvp:([\d]{7}\.[\d]{1,10})/)[1];
  298. title = i.match(/title: \'(.*)\',/)[1];
  299. url = "aHR0cHM6Ly9wbGF5ZXItYXBpLmRyZWFtbGFiLnBsLz9ib2R5W2lkXT0rbSsmYm9keVtqc29ucnBjXT0yLjAmYm9keVttZXRob2RdPWdldF9hc3NldF9kZXRhaWwmYm9keVtwYXJhbXNdW0lEX1B1Ymxpa2FjamldPSttKyZib2R5W3BhcmFtc11bU2VydmljZV09dm9kLm9uZXQucGwmY29udGVudC10eXBlPWFwcGxpY2F0aW9uL2pzb25wJngtb25ldC1hcHA9cGxheWVyLmZyb250Lm9uZXRhcGkucGwmY2FsbGJhY2s9";
  300. url = (atob(url)).replace(/\+m\+/g, m);
  301. xhr = new XMLHttpRequest();
  302. xhr.open('GET', url, false);
  303. xhr.send(null);
  304. v = JSON.parse(xhr.responseText);
  305. vc = v.result[0].formats.wideo.mp4;
  306. if (!vc) {
  307. alert('Niestety, ale materiał jest zabezpieczony DRM i nie będzie można go pobrać :(');
  308. return;
  309. }
  310. title = v.result[0].meta.title;
  311. for (var i = -1, cc = [], dd = [], l = vc.length >>> 0; ++i !== l; null) {
  312. dd[i] = cc[i] = vc[i].video_bitrate;
  313. }
  314. dd.sort(function(a, b) {
  315. return b - a;
  316. });
  317. //pagecreate(title);
  318.  
  319. DocumentWriteFirefoxFix = "";
  320. var randomText = makeid();
  321. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + '<p>Tytuł: ' + title + '</p>';
  322. var HighestResolution = 0;
  323. var HighestResolutionLink = '';
  324. for (var j = 0, len = dd.length; j < len; j = j + 1) {
  325. dlurl = vc[cc.indexOf(dd[j])].url;
  326. bitrate = vc[cc.indexOf(dd[j])].video_bitrate;
  327. vertical_resolution = vc[cc.indexOf(dd[j])].vertical_resolution;
  328. /*container.appendChild(createNode("pre", {}, {
  329. textContent: "Bitrate: " + bitrate + " - Rozdzielczość pionowa: " + vertical_resolution
  330. }));
  331. w = 'wget --restrict-file-names=windows --progress=bar --header="User-Agent:ABC" -c -O "' + title + '.mp4" ' + dlurl;
  332. buttoncreate(dlurl, title, w);*/
  333. if (vertical_resolution > HighestResolution) {
  334. HighestResolution = vertical_resolution;
  335. HighestResolutionLink = dlurl;
  336. }
  337. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + '<p>Bitrate: ' + bitrate + ' - Rozdzielczość pionowa: ' + vertical_resolution + '<br>';
  338. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + "Link do materiału: <button id=\"button-" + j + "\" type=\"button\">Kopiuj</button><br><a target=\"_blank\" href=\"" + dlurl + "\">" + dlurl + "</a></p>";
  339. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + "<script>var but = document.getElementById('button-"+j+"');but.addEventListener('click', function(){copyText(\""+ dlurl +"\");document.getElementById('button-"+j+"').setAttribute(\"class\", \"clicked\");})</script>";
  340. }
  341. if (HighestResolution > 0) {
  342. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + StyleText + '<script type="application/javascript">function ShowPromptWithInfo(lol){if (window.prompt("Aby skopiować link, wciśnij: CTRL+C, potem: ENTER aby rozpocząć pobieranie, lub ESC aby zakończyć działanie skryptu", lol)){document.location.href=lol;}}setTimeout(function () {ShowPromptWithInfo("' + HighestResolutionLink + '");}, 1000);' + SkryptKopiujText + '</script>';
  343. addJS_Node(null, null, fireNewTab);
  344. }
  345. }
  346. catch (e){
  347. if (location.href.match(/^http[s]?:\/\/vod\.pl\//) || location.href.match(/^http[s]?:\/\/bajki\.onet\.pl\//)) {
  348. var i = document.body.innerHTML;
  349. m = i.match(/mvp:([\d\.]+)\x22/);
  350. var url = "http://qi.ckm.onetapi.pl/?body[id]=22D4B3BC014A3C200BCA14CDFF3AC018&body[jsonrpc]=2.0&body[method]=get_asset_detail&body[params][ID_Publikacji]=" + m[1] + "&body[params][Service]=vod.onet.pl&content-type=application/jsonp&x-onet-app=player.front.onetapi.pl&_=1487536996333";
  351. document.location.href = url;
  352. } else if (location.href.match(/^http?:\/\/qi\.ckm.\onetapi\.pl\//)) {
  353. nn = document.querySelector("pre").textContent;
  354. v = JSON.parse(nn);
  355. vc = v.result[0].formats.wideo.mp4;
  356. for (var i = -1, cc = [], dd = [], l = vc.length >>> 0; ++i !== l; null) {
  357. dd[i] = cc[i] = vc[i].video_bitrate;
  358. };
  359. dd.sort(function(a, b) {
  360. return b - a;
  361. });
  362. for (var j = 0, len = dd.length; j < len; j = j + 1) {
  363. var dlurl = vc[cc.indexOf(dd[j])].url;
  364. if (dlurl !== undefined) {
  365. break;
  366. break;
  367. }
  368. };
  369. document.location.href = dlurl;
  370. }
  371. }
  372. }
  373.  
  374. function PokazLinkOnetApi(){
  375. var url = window.location.href;
  376. xhr = new XMLHttpRequest();
  377. xhr.open('GET', url, false);
  378. xhr.send(null);
  379. v = JSON.parse(xhr.responseText);
  380. vc = v.result[0].formats.wideo["mp4-uhd"];
  381. if (!vc) {
  382. alert('Niestety, ale materiał jest zabezpieczony DRM i nie będzie można go pobrać :(');
  383. return;
  384. };
  385. title = v.result[0].meta.title;
  386. for (var i = -1, cc = [], dd = [], l = vc.length >>> 0; ++i !== l; null) {
  387. dd[i] = cc[i] = vc[i].video_bitrate;
  388. alert(dd[i]);
  389. };
  390. dd.sort(function (a, b) {
  391. return b - a;
  392. });
  393. DocumentWriteFirefoxFix = "";
  394. var randomText = makeid();
  395. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + '<p>Tytuł: ' + title + '</p>';
  396. var HighestResolution = 0;
  397. var HighestResolutionLink = '';
  398. for (var j = 0, len = dd.length; j < len; j = j + 1) {
  399. dlurl = vc[cc.indexOf(dd[j])].url;
  400. bitrate = vc[cc.indexOf(dd[j])].video_bitrate;
  401. vertical_resolution = vc[cc.indexOf(dd[j])].vertical_resolution;
  402. /*container.appendChild(createNode("pre", {}, {
  403. textContent: "Bitrate: " + bitrate + " - Rozdzielczość pionowa: " + vertical_resolution
  404. }));
  405. w = 'wget --restrict-file-names=windows --progress=bar --header="User-Agent:ABC" -c -O "' + title + '.mp4" ' + dlurl;
  406. buttoncreate(dlurl, title, w);*/
  407. if (vertical_resolution > HighestResolution) {
  408. HighestResolution = vertical_resolution;
  409. HighestResolutionLink = dlurl;
  410. }
  411. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + '<p>Bitrate: ' + bitrate + ' - Rozdzielczość pionowa: ' + vertical_resolution + '<br>';
  412. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + "Link do materiału: <button id=\"button-" + j + "\" type=\"button\">Kopiuj</button><br><a target=\"_blank\" href=\"" + dlurl + "\">" + dlurl + "</a></p>";
  413. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + "<script>var but = document.getElementById('button-"+j+"');but.addEventListener('click', function(){copyText(\""+ dlurl +"\");document.getElementById('button-"+j+"').setAttribute(\"class\", \"clicked\");})</script>";
  414. }
  415. if (HighestResolution > 0) {
  416. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + StyleText + '<script type="application/javascript">function ShowPromptWithInfo(lol){if (window.prompt("Aby skopiować link, wciśnij: CTRL+C, potem: ENTER aby rozpocząć pobieranie, lub ESC aby zakończyć działanie skryptu", lol)){document.location.href=lol;}}setTimeout(function () {ShowPromptWithInfo("' + HighestResolutionLink + '");}, 1000);' + SkryptKopiujText + '</script>';
  417. //addJS_Node(null, null, fireNewTab);
  418. document.body.innerHTML = DocumentWriteFirefoxFix + "<br>" + document.body.innerHTML;
  419. }
  420. }
  421.  
  422. function PokazLinkTvp() {
  423. if (location.href.match(/^http[s]?:\/\/vod\.tvp\.pl\/[\d]{0,8}/)) {
  424. i = document.body.innerHTML;
  425. m = i.match(/object_id=([\d]{0,8})/);
  426. var znalezionotytul = false;
  427. st = 'Nieznane';
  428. tt = 'Nieznane';
  429. i = document.querySelector('.movieWrapper');
  430. if (i !== null) {
  431. i = i.querySelector('iframe').contentWindow.document.head.innerHTML;
  432. if (i !== null) {
  433. st = i.match(/\{name: \x22SeriesTitle\x22\, value: \x22(.*)\x22\},/) [1];
  434. tt = i.match(/\{name: \x22Title\x22\, value: \x22(.*)\x22\},/) [1];
  435. znalezionotytul = true;
  436. }
  437. }
  438. title = st + ' - ' + tt;
  439. xmlhttp = new XMLHttpRequest();
  440. xmlhttp.open('GET', 'https://www.tvp.pl/shared/cdn/tokenizer_v2.php?object_id=' + m[1], false);
  441. xmlhttp.send();
  442. o = JSON.parse(xmlhttp.responseText);
  443. v = o.formats;
  444. vc = [];
  445. if(v != null){
  446. for (var i = - 1, vc = [
  447. ], l = v.length >>> 0; ++i !== l; null) {
  448. if (v[i].adaptive == false) {
  449. vc.push(v[i]);
  450. };
  451. };
  452. }
  453. if (vc.length == 0) {
  454. alert('Niestety, ale materiał jest zabezpieczony DRM i nie będzie można go pobrać :(');
  455. return;
  456. };
  457. for (var i = - 1, cc = [
  458. ], dd = [
  459. ], l = vc.length >>> 0; ++i !== l; null) {
  460. dd[i] = cc[i] = vc[i].totalBitrate;
  461. };
  462. dd.sort(function (a, b) {
  463. return b - a;
  464. });
  465. DocumentWriteFirefoxFix = '';
  466. if (znalezionotytul) {
  467. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + '<p>Tytuł: ' + title + '</p>';
  468. }
  469. for (var j = 0, len = dd.length; j < len; j = j + 1) {
  470. dlurl = vc[cc.indexOf(dd[j])].url;
  471. bitrate = vc[cc.indexOf(dd[j])].totalBitrate;
  472. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + '<p>Bitrate: ' + bitrate + '<br>';
  473. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + "Link do materiału: <button id=\"button-" + j + "\" type=\"button\">Kopiuj</button><br><a target=\"_blank\" href=\"" + dlurl + "\">" + dlurl + "</a></p>";
  474. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + "<script>var but = document.getElementById('button-"+j+"');but.addEventListener('click', function(){copyText(\""+ dlurl +"\");document.getElementById('button-"+j+"').setAttribute(\"class\", \"clicked\");})</script>";
  475. }
  476. for (var j = 0, len = dd.length; j < len; j = j + 1) {
  477. dlurlbest = vc[cc.indexOf(dd[j])].url;
  478. if (dlurlbest !== undefined) {
  479. break;
  480. }
  481. }
  482. DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + StyleText + '<script type="application/javascript">function ShowPromptWithInfo(lol){if (window.prompt("Aby skopiować link, wciśnij: CTRL+C, potem: ENTER aby rozpocząć pobieranie, lub ESC aby zakończyć działanie skryptu", lol)){document.location.href=lol;}}setTimeout(function () {ShowPromptWithInfo("' + dlurlbest + '");}, 1000);' + SkryptKopiujText + '</script>';
  483. addJS_Node(null, null, fireNewTab);
  484. }
  485.  
  486. }
  487.  
  488. function PokazLinkCda() {
  489. if (typeof l === 'undefined') {
  490. var kolumny_list2 = 'pb-video-player';
  491. var list_czat = document.getElementsByClassName(kolumny_list2);
  492. if (list_czat.length > 0) {
  493. for (i = 0; i < list_czat.length; i++)
  494. {
  495. var vviideoo = list_czat[i].src;
  496. ShowPromptWithInfo(vviideoo);
  497. break;
  498. }
  499. }
  500. }
  501. else {
  502. ShowPromptWithInfo(l);
  503. }
  504. }
  505.  
  506. function SkryptDoPobieraniaStart() {
  507. if (Wlacz_skrypt) {
  508. var url = window.location.href;
  509. if (location.href.match(/^http[s]?:\/\/www\.ipla\.tv\//)) {
  510. var btnIpla = document.createElement('input');
  511. btnIpla.setAttribute('value', 'Pobierz video');
  512. btnIpla.setAttribute('type', 'button');
  513. btnIpla.setAttribute('id', 'btnIpla');
  514. btnIpla.setAttribute('style', 'position:fixed !important; left: 0px; top: 4px; width: 140px; height: 35px; background-color: #00a6ff; color: white; z-index: 1000000000;');
  515. document.getElementsByTagName('body') [0].appendChild(btnIpla);
  516. addEvent(document.getElementById('btnIpla'), 'click', function () {
  517. PokazLinkIpla();
  518. });
  519. }
  520. else if (url.indexOf('getmedia.redefine.pl') > - 1) {
  521. PokazLinkPobieranieIpla();
  522. }
  523. else if (location.href.match(/^http[s]?:\/\/(?:w{3}\.)?(?:tvn)?player\.pl\//)) {
  524. var btnTVNNowy = document.createElement('input');
  525. btnTVNNowy.setAttribute('value', 'Pobierz video');
  526. btnTVNNowy.setAttribute('type', 'button');
  527. btnTVNNowy.setAttribute('id', 'btnTVNNowy');
  528. btnTVNNowy.setAttribute('style', 'position:fixed !important; left: 0px; top: 1px; width: 115px; height: 30px; background-color: #00a6ff; color: white; z-index: 1000000000;');
  529. document.getElementsByTagName('body') [0].appendChild(btnTVNNowy);
  530. addEvent(document.getElementById('btnTVNNowy'), 'click', function () {
  531. PokazLinkTVNNowy();
  532. });
  533. }
  534. else if (location.href.match(/^http[s]?:\/\/vod\.pl\//)) {
  535. var btnOnet = document.createElement('input');
  536. btnOnet.setAttribute('value', 'Pobierz video');
  537. btnOnet.setAttribute('type', 'button');
  538. btnOnet.setAttribute('id', 'btnOnet');
  539. btnOnet.setAttribute('style', 'position:fixed !important; left: 0px; top: 2px; width: 110px; height: 25px; background-color: #2fd6ff; z-index: 1000000000;');
  540. document.getElementsByTagName('body') [0].appendChild(btnOnet);
  541. addEvent(document.getElementById('btnOnet'), 'click', function () {
  542. PokazLinkOnet();
  543. });
  544. }
  545. else if (location.href.match(/^http[s]?:\/\/qi\.ckm\.onetapi\.pl\//)) {
  546. PokazLinkOnetApi();
  547. }
  548. else if (location.href.match(/^http[s]?:\/\/vod\.tvp\.pl\/[\d]{0,8}/)) {
  549. i = document.body.innerHTML;
  550. m = i.match(/object_id=([\d]{0,8})/);
  551. if (m !== null) {
  552. if (url.indexOf('vod.tvp.pl/vod/slider') == - 1) {
  553. if (url.indexOf('tvp.pl/sess/tvplayer.php?') == - 1) {
  554. var btnTvp = document.createElement('input');
  555. btnTvp.setAttribute('value', 'Pobierz video');
  556. btnTvp.setAttribute('type', 'button');
  557. btnTvp.setAttribute('id', 'btnTvp');
  558. btnTvp.setAttribute('style', 'position:fixed !important; left: 0px; top: 10px; width: 100px; height: 35px; z-index: 1000000000;');
  559. document.getElementsByTagName('body') [0].appendChild(btnTvp);
  560. addEvent(document.getElementById('btnTvp'), 'click', function () {
  561. PokazLinkTvp();
  562. });
  563. }
  564. }
  565. }
  566. }
  567. else if (url.indexOf('www.cda.pl') > - 1) {
  568. var btnCda = document.createElement('input');
  569. btnCda.setAttribute('value', 'Pobierz video');
  570. btnCda.setAttribute('type', 'button');
  571. btnCda.setAttribute('id', 'btnCda');
  572. btnCda.setAttribute('style', 'position:fixed !important; left: 0px; top: 2px; width: 95px; height: 30px; z-index: 1000000000;');
  573. document.getElementsByTagName('body') [0].appendChild(btnCda);
  574. addEvent(document.getElementById('btnCda'), 'click', function () {
  575. PokazLinkCda();
  576. });
  577. }
  578. }
  579. }
  580. if(window.jQuery){
  581. $(document).ready(function() {
  582. SkryptDoPobieraniaStart();
  583. });
  584. }
  585. else{
  586. window.onload = SkryptDoPobieraniaStart();
  587. }
  588. /*document.addEventListener("DOMContentLoaded", function(event) {
  589. SkryptDoPobieraniaStart();
  590. });*/
Add Comment
Please, Sign In to add comment