// ==UserScript== // @name Video.mediaset.it native video player and direct links // @namespace http://andrealazzarotto.com // @description This script allows you to watch and download videos on Video Mediaset. // @include http://www.video.mediaset.it/video/* // @include http://www.video.mediaset.it/player/playerIFrame* // @version 5.2.2 // @require http://code.jquery.com/jquery-latest.min.js // @grant GM_xmlhttpRequest // @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html // @downloadURL none // ==/UserScript== var boxStyle = function(selector, color) { $(selector).css({ 'padding': '.5em', 'margin': '1em 4em', 'border': '1px solid #888', 'text-align': 'center', 'background-color': color, 'box-shadow': '0 .5em 1.5em 0 rgba(0, 0, 0, .7)', }); } // wrapper for non-Mozilla browsers if(!exportFunction) var exportFunction = function(a,b) {return a;}; $(document).ready(function(){ unsafeWindow.CDN_SELECTOR_URL = "http://video.lazza.dk/vd.php?id="; // kill ads unsafeWindow.adsEnabled = false; // load screenfull library $.getScript("https://cdn.rawgit.com/sindresorhus/screenfull.js/gh-pages/dist/screenfull.min.js"); var isIframe = (window.location.href.indexOf("playerIFrame") > 0); var id = 0; if(isIframe) id = window.location.href.split("id=")[1].split("&")[0]; else { var chunks = window.location.pathname.split("/"); id = chunks[4]; } GM_xmlhttpRequest({ method: 'GET', url: 'http://video.lazza.dk/vd.php?id='+id, headers: { 'Accept': 'application/atom+xml,application/xml,text/xml' }, onload: function(responseDetails) { var r = responseDetails.responseText; var doc = $.parseXML(r); $xml = $( doc ); var videos = $xml.find("video"); var vlinks = []; // parse video URLs videos.each(function (i) { var url = $( videos.get(i) ).attr("src"); var type = url.slice(-3); var name = ""; switch(type) { case "est": name = "Smooth streaming"; break; case "pl)": name = "Apple streaming"; break; case "flv": name = "Video FLV"; break; case "f4v": name = "Video F4V"; break; case "mp4": name = "Video MP4"; break; case "wmv": name = "Video WMV"; break; } vlinks.push( { na: name, url: url } ); }); // display video URLs num = vlinks.length; if(isIframe) $('