Beyond-HD 种子下载器(一键下载页面所有种子,间隔3秒)

下载 Beyond-HD 当前页面的所有种子

目前为 2024-12-20 提交的版本。查看 最新版本

// ==UserScript==
// @name         Beyond-HD 种子下载器(一键下载页面所有种子,间隔3秒)
// @namespace    https://gf.qytechs.cn/zh-CN/users/1413398-babalala
// @version      0.9
// @description  下载 Beyond-HD 当前页面的所有种子
// @author       BABAlala
// @match        https://beyond-hd.me/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    let downloadInterval = null;
    let dlButtons = [];
    let currentIndex = 0;

    // 创建“下载当前页面所有种子”按钮
    const startButton = document.createElement('button');
    startButton.textContent = '下载当前页面所有种子';
    startButton.style.position = 'fixed';
    startButton.style.top = '10px';
    startButton.style.right = '10px';
    startButton.style.zIndex = '9999';
    document.body.appendChild(startButton);

    // 创建“立即停止”按钮
    const stopButton = document.createElement('button');
    stopButton.textContent = '立即停止';
    stopButton.style.position = 'fixed';
    stopButton.style.top = '40px'; // 放在开始按钮下方
    stopButton.style.right = '10px';
    stopButton.style.zIndex = '9999';
    stopButton.disabled = true; // 初始禁用停止按钮
    document.body.appendChild(stopButton);

    // 查找符合条件的 DL 按钮
    function findDLButtons() {
        const allLinks = document.querySelectorAll('a');
        dlButtons = [];
        currentIndex = 0;

        allLinks.forEach(link => {
            // 使用 title 属性和 href 属性的开头部分进行判断
            if (link.title === "Download Torrent" && link.href.startsWith("https://beyond-hd.me/download/")) {
                dlButtons.push(link);
            }
        });

        console.log("找到符合条件的 DL 按钮数量:", dlButtons.length);
    }

    // 下载种子的函数
    function downloadTorrents() {
        if (currentIndex < dlButtons.length) {
            const dlButton = dlButtons[currentIndex];
            console.log("正在下载第", currentIndex + 1, "个种子,链接:", dlButton.href);
            dlButton.click();
            currentIndex++;
        } else {
            clearInterval(downloadInterval);
            downloadInterval = null;
            startButton.disabled = false;
            stopButton.disabled = true;
            alert('当前页面所有种子下载完成!');
        }
    }

    // 开始按钮的点击事件
    startButton.addEventListener('click', () => {
        findDLButtons();
        if (dlButtons.length > 0) {
            startButton.disabled = true;
            stopButton.disabled = false;
            downloadInterval = setInterval(downloadTorrents, 3000);
        } else {
            alert('没有找到符合条件的 DL 按钮!');
        }
    });

    // 停止按钮的点击事件
    stopButton.addEventListener('click', () => {
        clearInterval(downloadInterval);
        downloadInterval = null;
        startButton.disabled = false;
        stopButton.disabled = true;
        console.log("下载已停止");
        alert('下载已停止!');
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址