Greasy Fork is available in English.

Video.mediaset.it native video player and direct links

This script allows you to watch and download videos on Video Mediaset.

Precedente: v6.1.2 fixed login killer
Nuova: v6.2.2 fixed poster position

  • --- /tmp/diffy20200929-15046-1gpa6vd 2020-09-29 21:35:55.390937107 +0000
  • +++ /tmp/diffy20200929-15046-cgqlqi 2020-09-29 21:35:55.390937107 +0000
  • @@ -6,7 +6,7 @@
  • // @include http://www.video.mediaset.it/player/playerIFrame*
  • // @include http://www.mediaset.it/*
  • // @include http://www.tgcom24.mediaset.it/video/
  • -// @version 6.1.2
  • +// @version 6.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
  • @@ -107,8 +107,31 @@
  • });
  • };
  • -// wrapper for non-Mozilla browsers
  • -if(!exportFunction) var exportFunction = function(a,b) {return a;};
  • +var fix_videoplayer = function() {
  • + setTimeout(function() {
  • + if($('#videoPlayer').length) {
  • + $('#videoPlayer').remove();
  • + }
  • + else {
  • + setTimeout(arguments.callee, 400);
  • + }
  • + }, 400);
  • +}
  • +
  • +var initialize = function(id) {
  • + $('#myVideoContainer').remove();
  • + $('.video-player')
  • + .prepend('<div id="myVideoContainer"></div>')
  • + .prepend(
  • + '<script type="text/javascript">' +
  • + 'var initializer;' +
  • + 'var id = "' + id + '"; initializer = ' +
  • + 'new PlayerFramework.Initializer({ "containerElement":' + 'document.getElementById("myVideoContainer"), "id": id });' +
  • + '</script>'
  • + );
  • + fix_videoplayer();
  • + console.debug('Initialized.');
  • +}
  • $(document).ready(function(){
  • // handle live stream
  • @@ -128,13 +151,14 @@
  • // kill ads
  • unsafeWindow.adsEnabled = false;
  • - var isIframe = (window.location.href.indexOf("playerIFrame") > 0);
  • + var loc = window.location;
  • + var isIframe = (loc.href.indexOf("playerIFrame") > 0);
  • var id = (unsafeWindow.videoMetadataId) || 0;
  • if (!id) {
  • if(isIframe)
  • - id = window.location.href.split("id=")[1].split("&")[0];
  • + id = loc.href.split("id=")[1].split("&")[0];
  • else {
  • - var chunks = window.location.pathname.replace(/[\._]/g, "/").split("/");
  • + var chunks = loc.pathname.replace(/[\._]/g, "/").split("/");
  • for (var i in chunks) {
  • id = chunks[i];
  • if(!!parseInt(id) && id.length > 4)
  • @@ -144,13 +168,8 @@
  • }
  • // kill registration request
  • - if (!unsafeWindow.initializer) {
  • - unsafeWindow.initializer = new unsafeWindow.PlayerFramework.Initializer({
  • - "containerElement": document.getElementById("myVideoContainer"),
  • - "id": id
  • - });
  • - $('#videoPlayer').remove();
  • - }
  • -
  • + if (!!unsafeWindow.trafficlight)
  • + initialize(id);
  • +
  • GM_xmlhttpRequest({
  • method: 'GET',
  • @@ -187,8 +206,14 @@
  • if(isIframe)
  • $('<div id="video-links">').appendTo('body');
  • else {
  • - $('<div id="video-links">').appendTo('#box-apertura');
  • - $('#box-apertura').css('height', 'auto');
  • + $('#box-apertura').after('<div id="video-links">');
  • + $('#myVideoContainer').css({
  • + 'position': 'absolute',
  • + 'top': 0,
  • + 'bottom': 0,
  • + 'left': 0,
  • + 'right': 0
  • + }).parent().css('position', 'relative');
  • }
  • for(var i=0; i<num; i++) {
  • var o = vlinks[i];