// ==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/* // @version 4.4 // @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 MP4isOk = document.createElement('video').canPlayType('video/mp4'); $(document).ready(function(){ var chunks = window.location.pathname.split("/"); var 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 = []; var embed_url = ""; // 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": embed_url = url; name = "Video MP4"; break; case "wmv": name = "Video WMV"; break; } vlinks.push( { na: name, url: url } ); }); // display video URLs num = vlinks.length; $("#spinner").remove(); $('