动漫花园种子自动重命名

自动将动漫花园的会员专用链接所指向的文件文件名改为标题名

目前为 2020-05-26 提交的版本。查看 最新版本

// ==UserScript==
// @name         dmhy-torrent-auto-rename
// @name:zh-CN   动漫花园种子自动重命名
// @description  auto rename torrent for dmhy
// @description:zh-CN 自动将动漫花园的会员专用链接所指向的文件文件名改为标题名
// @match        *://dmhy.org/topics/view/*
// @match        *://www.dmhy.org/topics/view/*
// @match        *://share.dmhy.org/topics/view/*
// @author       菜姬
// @version      0.3
// @namespace    https://gf.qytechs.cn/users/171607
// @grant        GM_xmlhttpRequest
// @connect      dmhy.org
// @license      GPL version 3
// @encoding     utf-8
// ==/UserScript==
(function () {
    let urlblock = document.querySelector('#tabs-1 > p:nth-child(1) > a');
    let url = urlblock.getAttribute('href');
    let filename = urlblock.innerHTML + ".torrent";
    urlblock.onclick = (e) => {
        e.preventDefault();
        GM_xmlhttpRequest({
            method: "get",
            url: url,
            responseType: "blob",
            onload: function (r) {
                let blob = r.response;
                let anchor = document.createElement("a");
                anchor.href = URL.createObjectURL(blob);
                anchor.download = filename;
                anchor.style["display"] = "none";
                document.body.append(anchor);
                anchor.click();
                setTimeout(() => {
                    document.body.removeChild(anchor);
                    URL.revokeObjectURL(anchor.href);
                }, 0);
            }
        });
    };
})();

QingJ © 2025

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