Greasy Fork

来自缓存

Greasy Fork is available in English.

自动下载

自动下载助手

当前为 2023-08-08 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         自动下载
// @namespace    http://www.nite07.com/
// @version      0.1
// @description  自动下载助手
// @author       Nite07
// @match        https://oxy.st/d/*
// @match        https://uploadrar.com/*
// @grant        none
// @run-at document-end
// @license MIT
// ==/UserScript==

(() => {
	console.log('开始获取下载链接');
	switch (window.location.host) {
		case 'oxy.st':
			oxy();
			break;
		case 'uploadrar.com':
			uploadrar();
			break;
	}
})();

function oxy() {
	let linkElem = document.querySelector('div[data-batch_id="1"]');
	if (linkElem) {
		let link = linkElem.getAttribute('data-source_url');
		console.log('下载链接: ' + link);
		window.location.href = link;
	}
}

function uploadrar() {
	let freeDownloadBtn = document.querySelector('input[name="method_free"]');
	let createDownloadLinkBtn = document.querySelector('button#downloadbtn');
	let downloadBtn = document.querySelector('span#direct_link>a');
	if (freeDownloadBtn) {
		freeDownloadBtn.click();
	}
	if (createDownloadLinkBtn) {
		createDownloadLinkBtn.click();
	}
	if (downloadBtn) {
		downloadBtn.click();
	}
}