dailymotion.com video download link

By jk- Last update Jan 27, 2010 — Installed 3,273 times. Daily Installs: 4, 9, 4, 6, 7, 5, 5, 3, 5, 6, 4, 7, 11, 4, 9, 6, 5, 6, 6, 6, 2, 8, 3, 9, 8, 9, 6, 9, 8, 5, 5

There are 3 previous versions of this script.

// ==UserScript==
// @name         dailymotion.com video download link
// @namespace     http://www.digivill.net/~joykillr
// @description   Adds a download link to dailymotion.com so videos can be downloaded.  Works with and without javascript.
// @include        http://*.dailymotion.com/*
// @include        http://dailymotion.com/*
// ==/UserScript==
//
//v 2.0

var boo, tID, yz;
function addBox(strR,typ) {
	var detdsc = strR.match(/\d{1,4}x\d{1,4}/gi);
	if (strR.match(/\.flv/gi)) {detcdc = "FLV"} else if (strR.match(/\.on2/gi)) {detcdc = "ON2"} else if (strR.match(/\.mp4/gi)) {detcdc = "MP4"} else {detcdc = ""}
	if (typ&&typ!="") {detcdc = typ+"\ "+detcdc;}
	var URLDLbox = document.createElement("div");
	URLDLbox.setAttribute("style", "display: block !important;");
	URLDLbox.innerHTML = '<table style="width:auto; margin-left: auto; margin-right:auto;"><tbody style="background-color:inherit!important;">' +
		'<tr style="background-color:inherit!important;">' +
		'<td style="text-align:center;background-color:inherit!important;">' +
		'<a href="' + strR + '" style="font-size:108%; line-height:108%; color: #ffffff; background-color: #222222; border: 2px solid #7f7ebe; margin-left: auto; margin-right:auto; text-align:center; font-weight:bold;">Download ' + detdsc + ' ' + detcdc + ' Video </a>' + 
		'<br /></td></tr></tbody></table>';
	boo = true;
	var nElem = document.getElementsByTagName("div");
	for (var nn = 0; nn < nElem.length; nn++) {
		if (nElem[nn].getAttribute("class")){
		if (nElem[nn].getAttribute("class").match(/dm_widget_videoplayer/i)) {
			nElem[nn].insertBefore(URLDLbox,nElem[nn].lastChild);
			}}
		}
	}

boo = false;	
function altMeth(){
	var tID = "";
	tID = document.body.innerHTML.toString();
	if (tID&&tID!=""&&tID.indexOf("flashvars")!=-1) {
			yz = tID.split("flashvars")[1].split("\>")[0];
			if (yz.split('value\=\"')[1]) { yz = yz.split('value\=\"')[1];}
			if (yz.split('\&nextURL\=')[1]) {
				yz3 = yz.split('\&nextURL\=')[1].split('\"')[0];
				if (yz3!="" && yz3!=null) {yz3 = yz3.split('&url\=')[1].split('\&allowZoom\=')[0]; }
				yz3 = unescape(yz3);
				addBox(yz3);
			} else {
				yz = unescape(yz);
				if (zy.split("&video=")[1]) {zy = zy.split("&video=")[1].split("&")[0];}
				vrdo(yz);
			}
		}
	}

function vrdo(zy) {
	var n12 = zy.indexOf("http");
	if (n12!=0) {n12 = n12 - 1;
		n12 = zy.charAt(n12);
		zy = zy.split(n12)[1].split(n12)[0];
		}
	yzArray = zy.split("||");
	for (myAx = 0; myAx < yzArray.length; myAx++) {
		//addBox(yzArray[myAx].split("@@")[0],yzArray[myAx].split("@@")[1]);
		var zx = yzArray[myAx].split("@@");
		addBox(zx[0],zx[1]);
	}
}
	
if (document.body.getElementsByTagName("script")) {
	var n10 = document.body.getElementsByTagName("script");
	for (var yy = 0; yy<n10.length; yy++){
		if (n10&&n10[yy].innerHTML) {
			var n11 = n10[yy].innerHTML.toString();
			if (n11&&n11.indexOf('addVariable(\"video\"')!=-1) {
				yz = n11.split('addVariable(\"video\"')[1].split("\)\;")[0];
				yz = unescape(yz);
				vrdo(yz);
			} 
		} else if (boo==false&&yy+1==n10.length) {altMeth();}
	}
} else if (boo==false) {altMeth();}