// ==UserScript== // @name Player.pl: Skrypt umożliwiający pobieranie materiałów. Autor: Przemek // @namespace http://player.pl // @include http://player.pl/* // @version 1.0 // @description SKrypt umożliwiający pobieranie materiałów z serwisu player.pl // @author Przemek // @match http://player.pl/* // @grant none // @downloadURL none // ==/UserScript== /////////////////////// KONFIGURACJA //////////////////////// Wlacz_skrypt = true; //////////////////// KONIEC KONFIGURACJI //////////////////// function addEvent(obj, event, func) { if (obj.addEventListener) { obj.addEventListener(event, func, false); return true; } else if (obj.attachEvent) { obj.attachEvent('on' + event, func); } else { var f = obj['on' + event]; obj['on' + event] = typeof f === 'function' ? function() { f(); func(); } : func } } function texxt(lol){ window.prompt ("Aby skopiować link, wciśnij: CTRL+C, potem: ENTER", lol); } function PokazLink(){ var n = document.location.href.split(/[.,]/); var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET','/api/?platform=ConnectedTV&terminal=Samsung&format=json&v=2.0&authKey=ba786b315508f0920eca1c34d65534cd&type=episode&id='+n[n.length-2]+'&sort=newest&m=getItem&deviceScreenHeight=1080&deviceScreenWidth=1920',false); xmlhttp.send(); var o = eval('('+xmlhttp.responseText+')'); var heyhey9 = null; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { heyhey9 = xhr.response; // alert(heyhey9); texxt(heyhey9); return heyhey9; } } var link = o.item.videos.main.video_content[1].url; // texxt(link); var str = link; var res = str.replace("tvnplayer", "player"); xhr.open('GET', res, false); //alert(heyhey9); xhr.send(null); //texxt(o.item.videos.main.video_content[1].url); //document.location.href = o.item.videos.main.video_content[1].url; } function PokazLinkA(){ var n = document.location.href.split(/[.,]/); var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET','/api/?platform=ConnectedTV&terminal=Samsung&format=json&v=2.0&authKey=ba786b315508f0920eca1c34d65534cd&type=episode&id='+n[n.length-2]+'&sort=newest&m=getItem&deviceScreenHeight=1080&deviceScreenWidth=1920',false); xmlhttp.send(); var o = eval('('+xmlhttp.responseText+')'); var heyhey9 = null; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { heyhey9 = xhr.response; // alert(heyhey9); texxt(heyhey9); return heyhey9; } } var link = o.item.videos.main.video_content[0].url; // texxt(link); var str = link; var res = str.replace("tvnplayer", "player"); xhr.open('GET', res, false); //alert(heyhey9); xhr.send(null); //texxt(o.item.videos.main.video_content[1].url); //document.location.href = o.item.videos.main.video_content[1].url; } function PokazLinkB(){ var n = document.location.href.split(/[.,]/); var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET','/api/?platform=ConnectedTV&terminal=Samsung&format=json&v=2.0&authKey=ba786b315508f0920eca1c34d65534cd&type=episode&id='+n[n.length-2]+'&sort=newest&m=getItem&deviceScreenHeight=1080&deviceScreenWidth=1920',false); xmlhttp.send(); var o = eval('('+xmlhttp.responseText+')'); var heyhey9 = null; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { heyhey9 = xhr.response; // alert(heyhey9); texxt(heyhey9); return heyhey9; } } var link = o.item.videos.main.video_content[o.item.videos.main.video_content.length-1].url; // texxt(link); var str = link; var res = str.replace("tvnplayer", "player"); xhr.open('GET', res, false); //alert(heyhey9); xhr.send(null); //texxt(o.item.videos.main.video_content[1].url); //document.location.href = o.item.videos.main.video_content[1].url; } function RozpocznijPobieranie(){ //alert('hi'); var n = document.location.href.split(/[.,]/); var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET','/api/?platform=ConnectedTV&terminal=Samsung&format=json&v=2.0&authKey=ba786b315508f0920eca1c34d65534cd&type=episode&id='+n[n.length-2]+'&sort=newest&m=getItem&deviceScreenHeight=1080&deviceScreenWidth=1920',false); xmlhttp.send(); var o = eval('('+xmlhttp.responseText+')'); var s = o.item.videos.main.video_content[1].url; var m = s.match(/:\/\/(?:www\.)?(.[^/]+)(.*)/); var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET',m[2],false);xmlhttp.send(); document.location.href = xmlhttp.responseText; } function RozpocznijPobieranieA(){ //alert('hi'); var n = document.location.href.split(/[.,]/); var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET','/api/?platform=ConnectedTV&terminal=Samsung&format=json&v=2.0&authKey=ba786b315508f0920eca1c34d65534cd&type=episode&id='+n[n.length-2]+'&sort=newest&m=getItem&deviceScreenHeight=1080&deviceScreenWidth=1920',false); xmlhttp.send(); var o = eval('('+xmlhttp.responseText+')'); var s = o.item.videos.main.video_content[0].url; var m = s.match(/:\/\/(?:www\.)?(.[^/]+)(.*)/); var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET',m[2],false);xmlhttp.send(); document.location.href = xmlhttp.responseText; } function RozpocznijPobieranieA(){ //alert('hi'); var n = document.location.href.split(/[.,]/); var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET','/api/?platform=ConnectedTV&terminal=Samsung&format=json&v=2.0&authKey=ba786b315508f0920eca1c34d65534cd&type=episode&id='+n[n.length-2]+'&sort=newest&m=getItem&deviceScreenHeight=1080&deviceScreenWidth=1920',false); xmlhttp.send(); var o = eval('('+xmlhttp.responseText+')'); var s = o.item.videos.main.video_content[o.item.videos.main.video_content.length-1].url; var m = s.match(/:\/\/(?:www\.)?(.[^/]+)(.*)/); var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET',m[2],false);xmlhttp.send(); document.location.href = xmlhttp.responseText; } var btn = document.createElement( 'input' ); with( btn ) { setAttribute( 'onclick', 'PokazLink()' ); setAttribute( 'value', 'Pokaż Link: HD' ); setAttribute( 'type', 'button' ); setAttribute( 'id', 'btn1' ); setAttribute("style", "position:fixed !important; left: 0px; top: 70px; width: 115px; height: 35px; background-color: #00a6ff; color: white"); } var btna = document.createElement( 'input' ); with( btna ) { setAttribute( 'onclick', 'PokazLink()' ); setAttribute( 'value', 'MQ' ); setAttribute( 'type', 'button' ); setAttribute( 'id', 'btn1a' ); setAttribute("style", "position:fixed !important; left: 0px; top: 70px; left: 117px; width: 45px; height: 35px; background-color: #00a6ff; color: white"); } var btnb = document.createElement( 'input' ); with( btnb ) { setAttribute( 'onclick', 'PokazLink()' ); setAttribute( 'value', 'LQ' ); setAttribute( 'type', 'button' ); setAttribute( 'id', 'btn1b' ); setAttribute("style", "position:fixed !important; left: 0px; top: 70px; left: 164px; width: 45px; height: 35px; background-color: #00a6ff; color: white"); } var btn2 = document.createElement( 'input' ); with( btn2 ) { setAttribute( 'onclick', 'RozpocznijPobieranie()' ); setAttribute( 'value', 'Pobierz w: HD' ); setAttribute( 'type', 'button' ); setAttribute( 'id', 'btn2' ); setAttribute("style", "position:fixed !important; left: 0px; top: 70px; left: 219px; width: 110px; height: 35px; background-color: #00a6ff; color: white"); } var btn2a = document.createElement( 'input' ); with( btn2a ) { setAttribute( 'onclick', 'RozpocznijPobieranie()' ); setAttribute( 'value', 'MQ' ); setAttribute( 'type', 'button' ); setAttribute( 'id', 'btn2a' ); setAttribute("style", "position:fixed !important; left: 0px; top: 70px; left: 331px; width: 45px; height: 35px; background-color: #00a6ff; color: white"); } var btn2b = document.createElement( 'input' ); with( btn2b ) { setAttribute( 'onclick', 'RozpocznijPobieranie()' ); setAttribute( 'value', 'LQ' ); setAttribute( 'type', 'button' ); setAttribute( 'id', 'btn2a' ); setAttribute("style", "position:fixed !important; left: 0px; top: 70px; left: 378px; width: 45px; height: 35px; background-color: #00a6ff; color: white"); } function start() { if (Wlacz_skrypt){ /*alert('hi'); var n = document.location.href.split(/[.,]/); var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET','/api/?platform=ConnectedTV&terminal=Samsung&format=json&v=2.0&authKey=ba786b315508f0920eca1c34d65534cd&type=episode&id='+n[n.length-2]+'&sort=newest&m=getItem&deviceScreenHeight=1080&deviceScreenWidth=1920',false);xmlhttp.send(); var o = eval('('+xmlhttp.responseText+')'); var xxx = o.item.videos.main.video_content[1].url.length; alert(xxx); if (xxx > 1){*/ document.getElementsByTagName( 'body' )[ 0 ].appendChild( btn ); document.getElementsByTagName( 'body' )[ 0 ].appendChild( btna ); document.getElementsByTagName( 'body' )[ 0 ].appendChild( btnb ); document.getElementsByTagName( 'body' )[ 0 ].appendChild( btn2 ); document.getElementsByTagName( 'body' )[ 0 ].appendChild( btn2a ); document.getElementsByTagName( 'body' )[ 0 ].appendChild( btn2b ); addEvent(document.getElementById('btn1'), 'click', function() { PokazLink(); }); addEvent(document.getElementById('btn1a'), 'click', function() { PokazLinkA(); }); addEvent(document.getElementById('btn1b'), 'click', function() { PokazLinkB(); }); addEvent(document.getElementById('btn2'), 'click', function() { RozpocznijPobieranie(); }); addEvent(document.getElementById('btn2a'), 'click', function() { RozpocznijPobieranieA(); }); addEvent(document.getElementById('btn2b'), 'click', function() { RozpocznijPobieranieB(); }); } } window.onload=start();