l'ho fatto e mi apre questo, cosa vuol dire?
grazie
// ==UserScript==
// @name Rai.tv native video player and direct links
// @namespace
http://andrealazzarotto.com
// @description This script allows you to watch and download videos on Rai.tv.
// @include
http://www.rai.tv/dl/RaiTV/programmi/media/*
// @include
http://www.rai.tv/dl/RaiTV/tematiche/speciali/*
// @include
http://www.rai.tv/dl/replaytv/replaytv.html*
// @version 3.4
// @require
http://code.jquery.com/jquery-latest.min.js
// @grant GM_xmlhttpRequest
// ==/UserScript==
placeHolder = function(url, kind) {
$("#direct-link").remove();
$("div.Player").after("<div id='direct-link' />");
wi = $("div.Player").width();
w = wi*.6;
m = wi*.19;
// some styling
$("#direct-link")
.css('padding', '5px')
.css('margin', '10px '+m+'px')
.css('width', w+'px')
.css('border', '1px solid #888')
.css('text-align','center')
.css('box-shadow', '0px 5px 15px 0px rgba(0, 0, 0, .7)')
.css('background-color','#cfc')
.css('float','left');
// place the link
$("#direct-link")
.append("<a href='"+url+"'>" + kind + " Direct Link</a>");
$("#direct-link a")
.css('color','black')
.css('font-size','1.2em');
}
setUP = function(url, kind) {
placeHolder(url, kind);
// place the video
$($("div.Player div").get(0)).replaceWith("<embed width='100%'"
+ "height='100%' src='"
+ url + "' type='application/x-mplayer2' "
+ "autoplay='true' />");
};
decide = function(videoURL, videoURL_MP4, estensioneVideo) {
if (videoURL_MP4) { setUP(videoURL_MP4, "MP4"); }
else if (videoURL) {
if(estensioneVideo != 'WMV' || videoURL.indexOf("relinker") == -1) {
if(videoURL.toLowerCase().indexOf("mms") == 0)
setUP(videoURL, "MMS Stream");
else
setUP(videoURL, estensioneVideo);
}
else {// it's a relinker to an MMS stream
GM_xmlhttpRequest({
method: 'GET',
url: videoURL,
headers: {
'Accept': 'application/atom+xml,application/xml,text/xml'
},
onload: function(responseDetails) {
var r = responseDetails.responseText;
var doc = $.parseXML(r);
$xml = $( doc );
var url = $xml.find("REF").attr("HREF");
url = url.replace("http://", "mms://");
setUP(url, "MMS Stream");
}
});
} // end relinker
} // end if (videoURL)
}
$(document).ready(function(){
if(window.location.href.indexOf("programmi") != -1) {
videoURL = unsafeWindow.videoURL;
videoURL_MP4 = unsafeWindow.videoURL_MP4;
estensioneVideo = unsafeWindow.estensioneVideo;
if(estensioneVideo)
estensioneVideo = estensioneVideo.toUpperCase();
else
estensioneVideo = "Unknown";
decide(videoURL, videoURL_MP4, estensioneVideo);
} // end Rai.tv "standard"
// ========================================
else if(window.location.href.indexOf("tematiche") != -1) {
setInterval(function() {
document.HprevId = document.Hid;
document.Hid = $("div.Player").attr("data-id");
if(document.Hid && (document.Hid != document.HprevId)) {
completeURL = "
http://www.rai.tv/dl/RaiTV/programmi/media/"
+ document.Hid + ".html";
// get the original page content
GM_xmlhttpRequest({
method: 'GET',
url: completeURL,
onload: function(responseDetails) {
var r = responseDetails.responseText;
// kill script tags to avoid execution (and errors!)
r = r.replace(new RegExp('script', 'g'), 'dummy');
r = $('<div></div>').append(r);
var data = $(r).find("div#silverlightControlHost dummy").text();
// set the correct variables
var videoURL = data.match(/videoURL = ["'](.*?)["']/)[1];
var videoURL_MP4 = data.match(/videoURL_MP4 = ["'](.*?)["']/)[1];
var estensioneVideo = data.match(/estensioneVideo = ["'](.*?)["']/)[1];
decide(videoURL, videoURL_MP4, estensioneVideo);
}
});
}
}, 400);
} // end Tematiche
// ========================================
else {
unsafeWindow.isTVBrowser = true;
setInterval(function() {
document.HprevUrl = document.Hurl;
document.Hurl = $("video").attr("src");
if(document.Hurl && (document.Hurl != document.HprevUrl)) {
// call the link placeHolder
placeHolder(document.Hurl, "MP4");
// place the video
$("video").replaceWith("<embed width='100%' height='100%' src='"
+ document.Hurl + "' type='application/x-mplayer2' "
+ "autoplay='true' />");
}
}, 400);
} // end Rai Replay
});