Video.mediaset.it native video player and direct links

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

目前為 2014-06-29 提交的版本,檢視 最新版本

// ==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     4.5
// @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
// ==/UserScript==

var MP4isOk = document.createElement('video').canPlayType('video/mp4');

var boxStyle = function(selector, color) {
	$(selector).css({
				'padding': '5px',
				'margin': '10px 0',
				'border': '1px solid #888',
				'text-align': 'center',
				'background-color': color,
				'box-shadow': '0px 5px 15px 0px rgba(0, 0, 0, .7)',
			});
}

$(document).ready(function(){
	if(window.location.href.indexOf("playerIFrame") > 0) {
		var baseurl = "http://mdst.it/03v";
		var id = window.location.href.split("id=")[1].split("&")[0];
		$('<div id="notice" />').appendTo('body');
		boxStyle('#notice', '#eee');
		$('#notice').css({
				'position': 'absolute',
				'bottom': '15px',
				'left': '20%',
				'right': '20%',
			})
			.append('Download → <a href="' + baseurl +
				id + '/" target="_blank">Video Mediaset</a>')
			.append("<span id='close'>x</span>");
        $("#notice span").css({
			'font-weight': 'bold',
			'color': '#777',
			'position': 'absolute',
			'right': '10px',
			'cursor': 'pointer'
		}).click(function() {
				$("#notice").fadeOut();
			});
		return;
	}

	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();
		
			$('<div id="video-links">').appendTo('#box-apertura');
			boxStyle('#video-links', '#cfc');
			for(var i=0; i<num; i++) {
				var o = vlinks[i];
				var s = '<a href="'+o.url+'">'+o.na+'</a>';
				$(s).appendTo('#video-links');
				if(i!=num-1)
					$('<span>&nbsp;|&nbsp;</span>').css('color','#888').appendTo('#video-links');
			}
			
			// add video player
			if (embed_url) {
				setTimeout(function() {
					var style = $("#myVideoContainer").attr("style");
					if (style){
						if(unsafeWindow.myPlayer != null) {
							unsafeWindow.myPlayer.pause(); // mute annoying flash player
							unsafeWindow.count = 0;
							setTimeout(function() {
								unsafeWindow.myPlayer.pause(); // sometimes you need to do it again and again
								unsafeWindow.count++;
								if(unsafeWindow.count < 20)
									setTimeout(arguments.callee, 500);
							}, 500);
						}
						$("#myVideoContainer").empty();
						// hide useless icon
						$('#iframeIMGlink').remove();
						
						var tag = "<embed type='application/x-mplayer2' autoplay='true' ";
						if(MP4isOk && navigator.userAgent.indexOf("Chrome") > 0)
							tag = "<video autoplay controls ";
						
						$("#myVideoContainer").replaceWith(tag + "width='100%'"
						+ "height='100%' style='" + style + "' src='"
						+ embed_url + "' />");
					} else {
						setTimeout(arguments.callee, 400);
					}
				}, 400);
			}
		}
	});
});

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址