Greasy Fork

Skrypt umożliwiający pobieranie materiałów ze znanych serwisów VOD. Autor: Przemek

SKrypt umożliwiający pobieranie materiałów z serwisów Ipla.tv, Player.pl, Vod.pl

当前为 2016-01-23 提交的版本,查看 最新版本

// ==UserScript==
// @name         Skrypt umożliwiający pobieranie materiałów ze znanych serwisów VOD. Autor: Przemek
// @namespace    http://www.ipla.tv/
// @include      http://www.ipla.tv/* 
// @include      http://getmedia.redefine.pl/*
// @include      http://player.pl/*
// @include      http://vod.pl/*
// @include      http://*tvp.pl/*
// @include      http://*www.cda.pl/*
// @version      1.9
// @description  SKrypt umożliwiający pobieranie materiałów z serwisów Ipla.tv, Player.pl, Vod.pl
// @author       Przemek
// @match        http://www.ipla.tv/*
// @grant        none
// ==/UserScript==

/////////////////////// KONFIGURACJA ////////////////////////
Wlacz_skrypt = true; // true = skrypt włączony, false = skrypt wyłączony.
//////////////////// 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 texxtIpla(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;
    }
}

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);
            texxtIpla(heyhey9);
            return heyhey9;
        }
    }
   //alert(xmlhttp.responseText);
    //texxt(o.item.videos.main.video_content[0].url);
    var link = o.item.videos.main.video_content[1].url;
     
    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);
            texxtIpla(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);
            texxtIpla(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', 'Pobierz w: HD' );
  setAttribute( 'type', 'button' );
  setAttribute( 'id', 'btn1' );
  setAttribute("style", "position:fixed !important; left: 0px; top: 1px; width: 115px; height: 30px; background-color: #00a6ff; color: white; z-index: 1000000000;");
}

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: 1px; left: 117px; width: 45px; height: 30px; background-color: #00a6ff; color: white; z-index: 1000000000;");
}

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: 1px; left: 164px; width: 45px; height: 30px; background-color: #00a6ff; color: white; z-index: 1000000000;");
}

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: 1px; left: 219px; width: 110px; height: 30px; background-color: #00a6ff; color: white; z-index: 1000000000;");
}

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: 1px; left: 331px; width: 45px; height: 30px; background-color: #00a6ff; color: white; z-index: 1000000000;");
}

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: 1px; left: 378px; width: 45px; height: 30px; background-color: #00a6ff; color: white; z-index: 1000000000;");
}

function PokazLinkIpla(){
    var whatToOpen;
    if(document.location.href.indexOf('www.ipla.tv/')>0){
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET','/VOD/play-in-ipla/'+document.location.href.substr(document.location.href.indexOf('/vod-')+5),false);
xmlhttp.send();
var idn=xmlhttp.responseText.substr(xmlhttp.responseText.indexOf('ipla://playvod-1|')+17);
idn=idn.substr(0,idn.indexOf(' ')-1);
document.location.href='http://getmedia.redefine.pl/vods/get_vod/?cpid=1&ua=mipla/23&media_id='+idn;
whatToOpen = 'http://getmedia.redefine.pl/vods/get_vod/?cpid=1&ua=mipla/23&media_id='+idn;
}
else if(document.location.href.indexOf('getmedia.redefine.pl/')>0){
s=JSON.parse(document.body.textContent);
if(s.vod.video_hd)a=s.vod.video_hd;
else if(s.vod.video){
a=s.vod.video;
}else{a=s.vod.copies[0].url}
document.location.href=a;
     whatToOpen = a;
}
        }
        
function PokazLinkOnet(){
var i = document.body.innerHTML.substr(document.body.innerHTML.indexOf('id=' + atob('Ig==') + 'mvp:') + 8, 100);
i = i.substr(0, i.indexOf(atob('Ig==')));
s = atob('PGh0bWw+PGhlYWQ+PHNjcmlwdD4KZnVuY3Rpb24gbShlKXsKdj1ldmFsKGUpOwpmb3IgKGkgPSAwOyB2LnJlc3VsdFswXS5mb3JtYXRzLndpZGVvLm1wNC5sZW5ndGggPiBpO2k9aSsxKQogIGRvY3VtZW50LndyaXRlKHYucmVzdWx0WzBdLmZvcm1hdHMud2lkZW8ubXA0W2ldWyJ1cmwiXSsiICIrdi5yZXN1bHRbMF0uZm9ybWF0cy53aWRlby5tcDRbaV1bInZlcnRpY2FsX3Jlc29sdXRpb24iXSsicDxicj4iKTsKfQo8L3NjcmlwdD4KPHNjcmlwdCBzcmM9Imh0dHA6Ly9xaS5ja20ub25ldGFwaS5wbC8/Y2FsbGJhY2s9bSZib2R5W2lkXT1FQkJBRTFFNDMyNkU0Q0U5MzQzRkZFRUY1NkE5MTk4RCZib2R5W2pzb25ycGNdPTIuMCZib2R5W21ldGhvZF09Z2V0X2Fzc2V0X2RldGFpbCZib2R5W3BhcmFtc11bSURfUHVibGlrYWNqaV09UVFRUSZib2R5W3BhcmFtc11bU2VydmljZV09dm9kLm9uZXQucGwmY29udGVudC10eXBlPWFwcGxpY2F0aW9uJTJGanNvbnAmeC1vbmV0LWFwcD1wbGF5ZXIuZnJvbnQub25ldGFwaS5wbCZfPTEzNjIxNjQ5MTMxNDUiPjwvc2NyaXB0Pgo8L2hlYWQ+PGJvZHk+PC9ib2R5PjwvaHRtbD4K');
s = s.replace('QQQQ', i);
var win = open();
with(win.document) {
open();
write(s);
write("\x3Cscript type=\"text/javascript\"> var s=document.body.textContent; var searchonet0 = s.lastIndexOf('.mp4'); s = s.substr(0,searchonet0+10); var searchonet1 = s.indexOf(' 1080p'); if (searchonet1 == -1){searchonet1 = s.indexOf(' 720p');} if (searchonet1 == -1){searchonet1 = s.indexOf(' 576p');} if (searchonet1 == -1){searchonet1 = s.indexOf(' 480p');} if (searchonet1 == -1){searchonet1 = s.indexOf(' 360p');} if (searchonet1 == -1){searchonet1 = s.indexOf(' 240p');} var searchonet2 = s.substr(0,searchonet1); var searchonet3 = searchonet2.lastIndexOf('http://'); var searchonet4 = searchonet2.substr(searchonet3); if (window.prompt(\"Aby skopiować link, wciśnij: CTRL+C, potem: ENTER aby rozpocząć pobieranie, lub ESC aby zakończyć działanie skryptu\", searchonet4)){ document.location.href=searchonet4; } \x3C/script>");
close();


//var i=document.body.innerHTML.substr(document.body.innerHTML.indexOf('id='+atob('Ig==')+'mvp:')+8,100);
//i=i.substr(0,i.indexOf(atob('Ig==')));
//s=atob('PGh0bWw+PGhlYWQ+PHNjcmlwdD4KZnVuY3Rpb24gbShlKXsKdj1ldmFsKGUpOwpkb2N1bWVudC5sb2NhdGlvbi5ocmVmPXYucmVzdWx0WzBdLmZvcm1hdHMud2lkZW8ubXA0W3YucmVzdWx0WzBdLmZvcm1hdHMud2lkZW8ubXA0Lmxlbmd0aC0xXVsidXJsIl07Cn0KPC9zY3JpcHQ+CjxzY3JpcHQgc3JjPSJodHRwOi8vcWkuY2ttLm9uZXRhcGkucGwvP2NhbGxiYWNrPW0mYm9keVtpZF09RUJCQUUxRTQzMjZFNENFOTM0M0ZGRUVGNTZBOTE5OEQmYm9keVtqc29ucnBjXT0yLjAmYm9keVttZXRob2RdPWdldF9hc3NldF9kZXRhaWwmYm9keVtwYXJhbXNdW0lEX1B1Ymxpa2FjamldPVFRUVEmYm9keVtwYXJhbXNdW1NlcnZpY2VdPXZvZC5vbmV0LnBsJmNvbnRlbnQtdHlwZT1hcHBsaWNhdGlvbiUyRmpzb25wJngtb25ldC1hcHA9cGxheWVyLmZyb250Lm9uZXRhcGkucGwmXz0xMzYyMTY0OTEzMTQ1Ij48L3NjcmlwdD4gCjwvaGVhZD48Ym9keT48L2JvZHk+PC9odG1sPg==');
//s=s.replace('QQQQ',i);
//var win=open();
//with(win.document){open();
//write(s);
//close();               
}
}

function PokazLinkTvp(){
var xmlhttp = new XMLHttpRequest();
        m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('data-video-id=') + 15, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('data-videoid=') + 14, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('/player/video?id=') + 17, 8);
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('/player/') + 8, 8);
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('video_id=') + 9, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('object_id:') + 10, 9).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('amp;object_id=') + 14, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('object_id=') + 10, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) {
            n = document.location.href.split(/[?/=-]/);
            m = n[n.length - 2];
        }
        if (!/^\d+$/.test(m)) m = n[n.length - 1];
        xmlhttp.open('GET', 'http://www.tvp.pl/shared/cdn/tokenizer_v2.php?object_id=' + m, false);
        xmlhttp.send();
        var o = eval('(' + xmlhttp.responseText + ')');
        maxbitrate = 0;
        maxurl = '';
        for (i = 0; o.formats.length > i; i = i + 1) {
            if ((o.formats[i].totalBitrate > maxbitrate) && (o.formats[i].adaptive == false)) {
                maxbitrate = o.formats[i].totalBitrate;
                maxurl = o.formats[i].url;
            }
        }
//document.location.href=maxurl;
texxtIpla(maxurl);
}

function PokazLinkTvpA(){
var xmlhttp = new XMLHttpRequest();
        m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('data-video-id=') + 15, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('data-videoid=') + 14, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('/player/video?id=') + 17, 8);
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('/player/') + 8, 8);
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('video_id=') + 9, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('object_id:') + 10, 9).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('amp;object_id=') + 14, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('object_id=') + 10, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) {
            n = document.location.href.split(/[?/=-]/);
            m = n[n.length - 2];
        }
        if (!/^\d+$/.test(m)) m = n[n.length - 1];
        xmlhttp.open('GET', 'http://www.tvp.pl/shared/cdn/tokenizer_v2.php?object_id=' + m, false);
        xmlhttp.send();
        var o = eval('(' + xmlhttp.responseText + ')');
        maxbitrate = 0;
        maxurl = '';
        for (i = 0; o.formats.length > i; i = i + 1) {
            if ((o.formats[i].totalBitrate > maxbitrate && o.formats[i].totalBitrate < 2000000) && (o.formats[i].adaptive == false)) {
                maxbitrate = o.formats[i].totalBitrate;
                maxurl = o.formats[i].url;
            }
        }
//document.location.href=maxurl;
texxtIpla(maxurl);
}

function PokazLinkTvpB(){
var xmlhttp = new XMLHttpRequest();
        m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('data-video-id=') + 15, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('data-videoid=') + 14, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('/player/video?id=') + 17, 8);
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('/player/') + 8, 8);
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('video_id=') + 9, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('object_id:') + 10, 9).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('amp;object_id=') + 14, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) m = document.body.innerHTML.substr(document.body.innerHTML.indexOf('object_id=') + 10, 8).replace(/\D/g, '');
        if (!/^\d+$/.test(m)) {
            n = document.location.href.split(/[?/=-]/);
            m = n[n.length - 2];
        }
        if (!/^\d+$/.test(m)) m = n[n.length - 1];
        xmlhttp.open('GET', 'http://www.tvp.pl/shared/cdn/tokenizer_v2.php?object_id=' + m, false);
        xmlhttp.send();
        var o = eval('(' + xmlhttp.responseText + ')');
        maxbitrate = 5000000;
        maxurl = '';
        for (i = 0; o.formats.length > i; i = i + 1) {
            if ((o.formats[i].totalBitrate < maxbitrate) && (o.formats[i].adaptive == false)) {
                maxbitrate = o.formats[i].totalBitrate;
                maxurl = o.formats[i].url;
            }
        }
//document.location.href=maxurl;
texxtIpla(maxurl);
}

function PokazLinkPobieranieIpla(){
    var strona = document.body.innerText;
    var search1newnew = strona.indexOf('"quality_p": "1080p"');
    if (search1newnew > -1){
    var strona0newnew = strona.substr(0,search1newnew);
    var search2newnew = strona0newnew.lastIndexOf('"url":');
    if (search2newnew > -1){
    strona0newnew = strona0newnew.substr(search2newnew+8);
    var search3newnew = strona0newnew.indexOf('",');
    if (search3newnew > -1){
    strona0newnew  = strona0newnew.substr(0,search3newnew);
    texxtIpla(strona0newnew);
    }
    }
    }
    else {
    var search1new = strona.indexOf('"quality_p": "720p"');
    if (search1new > -1){
    var strona0new = strona.substr(0,search1new);
    var search2new = strona0new.lastIndexOf('"url":');
    if (search2new > -1){
    strona0new = strona0new.substr(search2new+8);
    var search3new = strona0new.indexOf('",');
    if (search3new > -1){
    strona0new = strona0new.substr(0,search3new);
    texxtIpla(strona0new);
    }
    }
    }
    else {
    var search1 = strona.indexOf('"video": "');
    var search2 = strona.substr(search1+10);
    var search3 = search2.indexOf('",');
    var search4 = search2.substr(0,search3);
    var link = search4
    texxtIpla(link);
    }
    }
}

function PokazLinkCda(){
texxtIpla(l);
}


var btnIpla = document.createElement( 'input' );
with( btnIpla ) {
  setAttribute( 'onclick', 'PokazLink()' );
    setAttribute( 'value', 'Pobierz video' );
  setAttribute( 'type', 'button' );
  setAttribute( 'id', 'btnIpla' );
  setAttribute("style", "position:fixed !important; left: 0px; top: 4px; width: 140px; height: 35px; background-color: #00a6ff; color: white; z-index: 1000000000;");
}


var btnOnet = document.createElement( 'input' );
with( btnOnet ) {
  setAttribute( 'onclick', 'PokazLink()' );
  setAttribute( 'value', 'Pobierz video' );
  setAttribute( 'type', 'button' );
  setAttribute( 'id', 'btnOnet' );
  setAttribute("style", "position:fixed !important; left: 0px; top: 2px; width: 110px; height: 25px; background-color: #2fd6ff; z-index: 1000000000;");
}

var btnTvp = document.createElement( 'input' );
with( btnTvp ) {
  setAttribute( 'onclick', 'PokazLink()' );
  setAttribute( 'value', 'Pobierz w: HD' );
  setAttribute( 'type', 'button' );
  setAttribute( 'id', 'btnTvp' );
  setAttribute("style", "position:fixed !important; left: 0px; top: 10px; width: 100px; height: 35px;  z-index: 1000000000;");
}

var btnTvpa = document.createElement( 'input' );
with( btnTvpa ) {
  setAttribute( 'onclick', 'PokazLink()' );
    setAttribute( 'value', 'MQ' );
  setAttribute( 'type', 'button' );
  setAttribute( 'id', 'btnTvpa' );
    setAttribute("style", "position:fixed !important; left: 102px; top: 10px; width: 40px; height: 35px;  z-index: 1000000000;");
}

var btnTvpb = document.createElement( 'input' );
with( btnTvpb ) {
  setAttribute( 'onclick', 'PokazLink()' );
    setAttribute( 'value', 'LQ' );
  setAttribute( 'type', 'button' );
  setAttribute( 'id', 'btnTvpb' );
    setAttribute("style", "position:fixed !important; left: 144px; top: 10px; width: 40px; height: 35px;  z-index: 1000000000;");
}





var btnCda = document.createElement( 'input' );
with( btnCda ) {
  setAttribute( 'onclick', 'PokazLink()' );
  setAttribute( 'value', 'Pobierz video' );
  setAttribute( 'type', 'button' );
  setAttribute( 'id', 'btnCda' );
  setAttribute("style", "position:fixed !important; left: 0px; top: 2px; width: 95px; height: 30px;  z-index: 1000000000;");
}

/*var btn2 = document.createElement( 'input' );
with( btn2 ) {
  setAttribute( 'onclick', 'RozpocznijPobieranie()' );
  setAttribute( 'value', 'Pobierz' );
  setAttribute( 'type', 'button' );
  setAttribute( 'id', 'btn2' );
    setAttribute("style", "position:fixed !important; left: 0px; top: 75px; left: 117px; width: px; height: 35px; background-color: #00a6ff; color: white");
}*/

function start() {
    if (Wlacz_skrypt){
    var url = window.location.href;
       //alert(url);
     if (url.indexOf("www.ipla.tv") > -1) {
    document.getElementsByTagName( 'body' )[ 0 ].appendChild( btnIpla );
   // document.getElementsByTagName( 'body' )[ 0 ].appendChild( btn2 );
        
        addEvent(document.getElementById('btnIpla'), 'click', function() {
            PokazLinkIpla();
            });
        /*addEvent(document.getElementById('btn2'), 'click', function() {
            RozpocznijPobieranie();
        });*/
        }
        else if (url.indexOf("getmedia.redefine.pl") > -1) {
           // alert('getmedia');
            PokazLinkPobieranieIpla();
        }
         else if (url.indexOf("player.pl") > -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();
             });*/
    }
            else if (url.indexOf("vod.pl") > -1) {
            document.getElementsByTagName( 'body' )[ 0 ].appendChild( btnOnet );
            addEvent(document.getElementById('btnOnet'), 'click', function() {
            PokazLinkOnet();
            });
            }
            else if (url.indexOf("tvp.pl") > -1) {
             if (url.indexOf("vod.tvp.pl/vod/slider") == -1) {
             if (url.indexOf("tvp.pl/sess/tvplayer.php?") == -1) {
            document.getElementsByTagName( 'body' )[ 0 ].appendChild( btnTvp );
            addEvent(document.getElementById('btnTvp'), 'click', function() {
            PokazLinkTvp();
            });
            document.getElementsByTagName( 'body' )[ 0 ].appendChild( btnTvpa );
            addEvent(document.getElementById('btnTvpa'), 'click', function() {
            PokazLinkTvpA();
            });
            document.getElementsByTagName( 'body' )[ 0 ].appendChild( btnTvpb );
            addEvent(document.getElementById('btnTvpb'), 'click', function() {
            PokazLinkTvpB();
            });
            }
            }
            }
            else if (url.indexOf("www.cda.pl") > -1){
            document.getElementsByTagName( 'body' )[ 0 ].appendChild( btnCda );
            addEvent(document.getElementById('btnCda'), 'click', function() {
            PokazLinkCda();
            });
            }
    }
}

window.onload=start();