dailymotion.com video download link

By jk- Last update Oct 4, 2008 — Installed 2,492 times. Daily Installs: 2, 4, 3, 4, 3, 4, 6, 5, 5, 5, 3, 2, 4, 5, 6, 3, 5, 3, 5, 5, 4, 3, 4, 3, 4, 2, 5, 7, 4, 5, 4, 3

There are 1 previous version 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 1.8

var boo, tID, yz;
function addBox(strR) {
	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 {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;

if (document.body.getElementsByTagName("param")) {
	tID = document.body.getElementsByTagName("param");
	for (var yy = 0;yy< tID.length; yy++){
		if (tID[yy].name.match(/flashvars/i)) {
			yz = tID[yy].value;
			yz = unescape(yz);
			var yz2 = yz.split("&video=")[1].split("&")[0];
			yzArray = yz2.split("||");
			for (myAx = 0; myAx < yzArray.length; myAx++) {
				addBox(yzArray[myAx].split("@@")[0]);
				}
			}
		}
	}

if (boo==false){
	tID = document.body.innerHTML.toString();
		if (tID.search("flashvars")!=-1) {
			yz = tID.split('name\=\"flashvars\"')[1].split(">")[0];
			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);
				var yz2 = yz.split("&video=")[1].split("&")[0];
				yzArray = yz2.split("||");
				for (myAx = 0; myAx < yzArray.length; myAx++) {
					//addBox(yzArray[myAx].split("@@")[0], yzArray[myAx].split("@@")[1]);
					addBox(yzArray[myAx].split("@@")[0]);
				}
			}
		}
	}