NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name ZooCab Download
// @version 1.3
// @grant none
// @run-at document-idle
// @include https://video.zoo.cab/video/*/*
// @include https://animalporn.rocks/video/*/*
// @include https://www.yiffyfur.tube/video/*
// @license MIT
// ==/UserScript==
(function () {
// add download buttons
const wrapper = document.getElementById("wrapper"),
wrapperChilds = wrapper.children.length,
notPrivate = document.getElementsByClassName("text-danger")[0].style.display == "none",
database_url = document.getElementsByTagName("video")[0].currentSrc,
file_servers = {
"animalporn.rocks": "https://cdn.sloppy.pink",
"www.yiffyfur.tube": "https://www.yiffyfur.tube"
},
file_server = file_servers[location.hostname];
let download_html = "", video_url = "";
// fetch and manipulate
const data = wrapper.children[wrapperChilds == 9 ? 3 : 2].innerHTML,
video_id = data.match(/vid[= "]+(\d+)/m)[1],
video_title = document.getElementsByTagName("h3")[0].innerHTML,
webseed = data.match(/h264Base = '([\/\w]+)/m),
iphoneVideo = /iphoneVideo = (true)/.test(data);
let files = data.match(/(\[\{[\\\"\w\:\,\.\}\]\{]+)/);
if (files) {
files = JSON.parse(files[0].replace("\\",""));
for (const file of files) {
download_html += `<div class='pull-right m-l-5'><a target='_blank' href='${database_url ? new URL(database_url).origin : file_server}${webseed ? webseed[1] : ""}${file.file}' class='btn btn-default'><i class='glyphicon glyphicon-download-alt'></i> <span class='hidden-xs'>${file.label}</span></a></div>`;
}
video_url = `${database_url ? new URL(database_url).origin : file_server}${webseed}${files[files.length-1].file}`;
}
else {
download_html = `<div class='pull-right m-l-5'><a target='_blank' href='${file_server}/media/videos/iphone/${video_id}.mp4' class='btn btn-default'><i class='glyphicon glyphicon-download-alt'></i><span class='hidden-xs'>SD</span></a></div><div class='pull-right m-l-5'><a target='_blank' href='${file_server}/media/videos/hd/${video_id}.mp4' class='btn btn-default'><i class='glyphicon glyphicon-download-alt'></i> <span class='hidden-xs'>HD</span></a></div>`;
video_url = `https://${file_server}/media/videos/hd/${video_id}.mp4`;
}
console.info("Download Info:", {video_title, video_id, files});
// insert elements
if (notPrivate) {
const controls = document.getElementById("share_video").parentNode;
if (controls) {
const downloadMenu = document.createElement("div");
downloadMenu.style.width = "100%";
downloadMenu.className = "pull-right m-t-15";
downloadMenu.innerHTML = download_html;
controls.parentNode.insertBefore(downloadMenu, controls.nextSibling);
}
else {
console.error("Can't find controls?");
}
}
else {
wrapper.getElementsByClassName("container")[0].innerHTML = `<div class='row'><div class='col-md-8'><h3 class='hidden-xs big-title-truncate m-t-0'>${video_title}</h3></div></div><div class='row'><div class='col-md-8'><div class='video-container'><div class='video-js vjs-16-9'><video class='vjs-tech' poster='https://video.zoo.cab/media/videos/tmb/${video_id}/default.jpg' tabindex='-1' controls src='${video_url}'></video></div></div><div class='pull-right m-t-15' style='width: 100%;'>${download_html}</div></div></div>`;
}
})();