// ==UserScript==
// @name Skrypt umożliwiający pobieranie materiałów ze znanych serwisów VOD.
// @namespace http://www.ipla.tv/
// @include *www.ipla.tv/*
// @include *getmedia.redefine.pl/*
// @include *player.pl/*
// @include *vod.pl/*
// @include *tvp.pl/*
// @include *www.cda.pl/*
// @version 4.3
// @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.
// @author Przemek
// @match http://www.ipla.tv/*
// @grant none
// @downloadURL none
// ==/UserScript==
//Ważne:
//Skrypt opiera się na skryptach umieszczonych na stronie: miniskrypt.blogspot.com
//oraz: miniskrypt.hubaiitv.pl. Moje rozszerzenie tylko i wyłącznie dodaje wygodne
//w użyciu przyciski, jednak nie jestem autorem większości kodu.
//Skrypt jest niepubliczny, a dostęp do niego mają tylko i wyłącznie osoby z linkiem.
/////////////////////// KONFIGURACJA ////////////////////////
Wlacz_skrypt = true; // true = skrypt włączony, false = skrypt wyłączony.
//////////////////// KONIEC KONFIGURACJI ////////////////////
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()} ";
var StyleText = "";
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 ShowPromptWithInfo(lol, info = null) {
var infotext = 'Aby skopiować link, wciśnij: CTRL+C, potem: ENTER aby rozpocząć pobieranie, lub ESC aby zakończyć działanie skryptu';
if(info !== null){
infotext = infotext + ". " + info;
}
if (window.prompt(infotext, lol)) {
document.location.href = lol;
}
}
function ShowPrompt(lol) {
window.prompt('Aby skopiować link, wciśnij: CTRL+C, potem: ENTER', lol);
}
function makeid()
{
var text = '';
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (var i = 0; i < 5; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
var DocumentWriteFirefoxFix = '';
function fireNewTab() {
function makeid2() {
var text = '';
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (var i = 0; i < 5; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
var randomText = makeid2();
var newTab = window.open('about:blank', 'MsgWindow-' + randomText);
newTab.document.write("DocumentWriteFirefoxFix");
newTab.addEventListener('load', function () {
alert('hi2');
var destDoc = newTab.document;
destDoc.open();
destDoc.write("DocumentWriteFirefoxFix");
destDoc.close();
}, false
);
}
function addslashes( str ) {
return (str + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0');
}
function addJS_Node(text, s_URL, funcToRun, runOnLoad) {
var D = document;
var scriptNode = D.createElement('script');
if (runOnLoad) {
scriptNode.addEventListener('load', runOnLoad, false);
}
scriptNode.type = 'text/javascript';
if (text) scriptNode.textContent = text;
if (s_URL) scriptNode.src = s_URL;
var str = funcToRun.toString();
var tes = addslashes(DocumentWriteFirefoxFix);
var res = str.replace("DocumentWriteFirefoxFix", tes);
res = res.replace("DocumentWriteFirefoxFix", tes);
if (funcToRun) scriptNode.textContent = '(' + res + ')()';
var targ = D.getElementsByTagName('head') [0] || D.body || D.documentElement;
targ.appendChild(scriptNode);
}
function PokazLinkTVNNowy() {
try {
try {
n = document.querySelector("#detailEpisode").getAttribute("data-article-id");
} catch (e) {
var pageURL = window.location.href;
var lastComma = pageURL.lastIndexOf(",");
if (lastComma > - 1) {
n = pageURL.substring(lastComma+1);
n = parseInt(n);
}
}
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "/api/?platform=ConnectedTV&terminal=Panasonic&format=json&authKey=064fda5ab26dc1dd936f5c6e84b7d3c2&v=3.1&m=getItem&id=" + n, false);
xmlhttp.send();
o = JSON.parse(xmlhttp.responseText);
lt = o.item.videos.main.video_content_license_type;
dd = o.item.videos.main.video_content;
title = o.item.serie_title + " - S" + o.item.season + "E" + o.item.episode;
if (lt !== null) {
alert('DRM lub brak materiału TV :(');
return;
}
DocumentWriteFirefoxFix = "";
var randomText = makeid();
DocumentWriteFirefoxFix = DocumentWriteFirefoxFix + '