Greasy Fork

Streamcloud Download Button

This script adds a download button to the streamcloud.eu page.

目前为 2016-06-20 提交的版本。查看 最新版本

// ==UserScript==
// @name        Streamcloud Download Button
// @namespace   SCDB
// @author      MegaByte
// @description This script adds a download button to the streamcloud.eu page.
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @run-at 	document-end
// @noframes
// @include     http*://*streamcloud.eu/*
// @version     1.0
// ==/UserScript==


var player = $("#player_code");

if(player.length != 0) {
	player.find("script").each(function() {
		var patt = new RegExp("file:\\s?\"http:\\/\\/.+?\\.mp4\"");
		console.log(patt);
		var res = patt.exec($(this).html());
		console.log(res);
		if(res !== null) {
			var url = res[0].substring(7, res[0].length-1);
			addButton(url);
		}
	});
}

function addButton(url) {
	$(".container-fluid ul.nav").prepend("<li><a href='" + url + "' download target='_blank'>Download</a></li>")
}