ZooCab Download

Adds download buttons on videos

13.12.2019 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        ZooCab Download
// @description Adds download buttons on videos
// @namespace   ZooCab-Download
// @version     1.0
// @grant       none
// @run-at      document-idle
// @include     https://video.zoo.cab/video/*/*
// ==/UserScript==

(function () {
	// add download buttons
	const wrapper = document.getElementById("wrapper"),
	notPrivate = document.getElementsByClassName("text-danger")[0].style.display == "none";
	let download_html = "", video_url = "";

	// fetch and manipulate content
	const data = wrapper.children[2].innerHTML,
	video_id = data.match(/vid = (\d+)/m)[1],
	video_title = document.title.match(/(.+) - Zoo.cab Beastiality Videos$/m)[1],
	webseed = data.match(/h264Base = '([\/\w]+)/m)[1],
	iphoneVideo = /iphoneVideo = (true)/.test(data),
	files = JSON.parse(data.match(/(\[\{[\\\"\w\:\,\.\}\]\{]+)/)[0].replace("\\",""));
	if (iphoneVideo) {
		download_html = `<div class='pull-right m-l-5'><a target='_blank' href='https://video.zoo.cab/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='https://video.zoo.cab/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://video.zoo.cab/media/videos/iphone/${video_id}.mp4`
	}
	else {
		for (const file of files) {
			download_html += `<div class='pull-right m-l-5'><a target='_blank' href='http://cdn.sloppyta.co${webseed}${file.file}' class='btn btn-default'><i class='glyphicon glyphicon-download-alt'></i> <span class='hidden-xs'>${file.label}</span></a></div>`;
		}
		video_url = `http://cdn.sloppyta.co${webseed}${files[files.length-1].file}`;
	}
	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>`;
	}
})();