asianleak hd download options

Add buttons to download multiple res of video.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name     asianleak hd download options
// @include  https://asianleak.com/videos/*/*/
// @grant	 none
// @description Add buttons to download multiple res of video.
// @version 0.0.1.20210416094546
// @namespace https://greasyfork.org/users/760233
// ==/UserScript==

setTimeout(() => {
	console.log(window.flashvars);

	let myVars = window.flashvars;

	/*
		video_alt_url: "https://asianleak.com/get_file/1/1d61f6a55fda088acc81cd3ae03f3a7914643f1d0f/2000/2243/2243_720p.mp4/"
		video_alt_url2: "https://asianleak.com/get_file/1/4542e56d5ee5b8de37d399fe5b4183aa924016888b/2000/2243/2243_1080p.mp4/"
		video_alt_url2_hd: "1"
		video_alt_url2_text: "1080p"
		video_alt_url_hd: "1"
		video_alt_url_text: "720p"
	*/

	if (myVars.hasOwnProperty("video_alt_url")) {
		AddNewBtn(myVars.video_alt_url + "?download=true", myVars.postfix + " " + myVars.video_alt_url_text);
	}

	if (myVars.hasOwnProperty("video_alt_url2")) {
		AddNewBtn(myVars.video_alt_url2 + "?download=true", myVars.postfix + " " + myVars.video_alt_url2_text);
	}

	function AddNewBtn(videoUrl, btnText){
		let newBtn = document.createElement("a");
		newBtn.href = videoUrl;
		newBtn.innerText = btnText;
		let defaultDlBtn = document.querySelector("#tab_video_info > div > div.info > div:nth-child(5) > a");
		defaultDlBtn.parentNode.insertBefore(newBtn, defaultDlBtn.nextSibling);
	}
}, 2000);