By jk-
Has 35 other scripts.
// ==UserScript==
// @name liveleak.com video download link
// @namespace http://www.digivill.net/~joykillr
// @description Adds a download link to liveleak.com so videos can be downloaded.
// @include http://liveleak.com/view*
// @include http://*.liveleak.com/view*
// @include http://*.liveleak.com/player.swf?*
// @include http://liveleak.com/player.swf?*
// ==/UserScript==
//
//v 4.5
var tID, dat, v1;
var tStr = "http\:\/\/www\.liveleak\.com\/mi\?token\=";
function getURL(tokenURL) {
GM_xmlhttpRequest({
method:"GET",
url:tokenURL,
headers:{
"User-Agent":"Mozilla/5.0 Firefox/2.0.0.9",
"Accept":"text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
},
onload:function(details) {
var URLstring = new String(details.responseText);
URLstring = URLstring.split("file_location=")[1];
var splitidx = URLstring.indexOf("placeholder_");
splitidx = splitidx - 1;
URLstring = URLstring.substring(0, splitidx);
URLstring = unescape(URLstring);
//URLstring = URLstring.split("?")[0];
if (URLstring) {
addBox(URLstring);
}
}
});
}
function addBox(strR) {
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: #570000; border: 2px solid #9b0000; margin-left: auto; margin-right:auto; text-align:center; font-weight:bold;">Click Here To Download Video</a>' +
'<br /></td></tr></tbody></table>';
if (window.content.location.href.search("player.swf")==-1) {
var nElem = document.getElementsByTagName("div");
for (var nn = 0; nn < nElem.length; nn++) {
if ((nElem[nn].title.search("player.swf"))||(nElem[nn].getAttribute("dataattribute").search("player.swf"))) {
if (document.getElementById("sn")) {
document.getElementById("sn").appendChild(URLDLbox);
} else if (document.getElementById("vid")) {
document.getElementById("vid").appendChild(URLDLbox);
} else {
nElem[nn].appendChild(URLDLbox);
//document.getElementById("bo").insertBefore(URLDLbox,document.getElementById("bo").lastChild);
}
}
}} else {
if (document.getElementById("vid")) {document.getElementById("vid").appendChild(URLDLbox);} else {document.body.insertBefore(URLDLbox,document.body.firstChild);}
}
}
function processVars(tID) {
var go2 = 0;
tID = tID.getAttribute("value");
if (tID.indexOf("token\=")!=-1) {
tID = tID.split('token\=')[1].split('\"'||'\"')[0];
go2 = 1;
} else if (tID.indexOf('name="movie"')!=-1) {
tID = tID.split('name="movie"')[1].split('\/param')[0];
tID = tID.split('value\="')[1].split('\"')[0];
tID = tID.split("\/");
tIDx = tID.length;
tID = tID[tIDx-1];
go2 = 1;
}
if (go2>=1) {
var token = tStr + tID;
return token;
}
}
function parseL(j2) {
j2=j2.split("i=")[1].split("&")[0];
return j2;
}
function run(){
dat, v1 = "";
var wclh = window.content.location.href.toString();
if ((wclh.search("player.swf")!=-1)&&(wclh.search("token")!=-1)) {
var tID1 = wclh.href.split('token\=')[1].split('\&')[0];
var dat = tStr + tID1;
} else {
if (document.body.getElementsByTagName("param")[0]) {
v1 = document.body.getElementsByTagName("param")[0];
dat = processVars(v1);
} else if (document.body.getElementsByTagName("input")){
var tID = document.body.getElementsByTagName("input");
for (var yy=0;yy<tID.length;yy++){
if (tID[yy].name.match(/media_embed_code/i)) {
v1 = tID[yy];
dat = processVars(v1);
}
}
}
}
if ((dat=="")||(dat==null)&&(wclh.search("i=")!=-1)) {
dat = tStr + parseL(wclh);
}
if (dat!=""&&dat!=null) {
getURL(dat);
}
}
run();