There are 5 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.
// @version 3.0
// @include http://*.dailymotion.com/*
// @include http://dailymotion.com/*
// @include https://*.dailymotion.com/*
// @include https://dailymotion.com/*
// ==/UserScript==
//
//v 3.0
var ldurl, sdurl, hdurl, autourl, videoid, scripts = document.getElementsByTagName("scripts");
function getDocument(url) {
GM_xmlhttpRequest({
method:"GET",
url:url,
headers:{
"User-Agent":"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.16) Gecko/20120427 Firefox/15.0a1",
"Accept":"application/xml,text/xml"
},
onload:function(details) {
getURLs(JSON.parse(details.responseText));
}
});
}
function addLinks(x) {
for (y=0; y<x.length; y++) {
if (x[y]!=null&&x[y]!="") {
strR = x[y];
var newlink = "", detdsc = "", detcdc = "";
var newlink = document.createElement("a");
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 = ""}
newlink.setAttribute("href", x[y]);
newlink.setAttribute("class", "sd_user_subscribe icn_left popup_ie_width width_500 icon_subscribe");
newlink.textContent = "DL: " + detdsc + " " + detcdc;
document.getElementById("video_views_count").parentNode.insertBefore(newlink, document.getElementById("video_views_count"));
}
}
}
function getURLs(data) {
data = eval(data);
var seq = data.sequence[0].layerList[0].sequenceList;
for (var b=0; b< seq.length; b++) {
if (seq[b].name.match(/main/i)) {
var seq2 = seq[b].layerList;
for (var c=0; c< seq2.length; c++) {
if (seq2[c].name.match(/video/i)) {
var seq3 = seq2[c];
if (seq3.param.ldURL) {ldurl = seq3.param.ldURL;} else {ldurl = "";}
if (seq3.param.sdURL) {sdurl = seq3.param.sdURL;} else {sdurl = "";}
if (seq3.param.hdURL) {hdurl = seq3.param.hdURL;} else {hdurl = "";}
//if (seq3.param.autoURL) {autourl = seq3.param.autoURL;} else {autourl = "";}
var links = [autourl,ldurl,sdurl,hdurl]
addLinks(links);
break;
}
}
break;
}
}
}
for (var a=0; a<scripts.length; a++) {
if (scripts[a].indexOf("DM_CurrentVideoXID")!=-1) {
videoid = scripts[a].split("DM_CurrentVideoXID='")[1].split("'")[0];
break;
}
}
if (videoid==null||videoid=="") {
videoid = document.location.href.split("/video/")[1].split("_")[0];
}
if (videoid!=null||videoid!="") {
getDocument("http://www.dailymotion.com/sequence/full/"+videoid);
}