您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
PT一键领种
当前为
// ==UserScript== // @name 一键领种 // @author waibuzheng // @description PT一键领种 // @match http*://*/userdetails.php?id=* // @icon https://image.zmpt.cc/imgs/2023/11/5c60a64ce9d1104a.png // @run-at document-end // @version 0.4 // @grant GM_xmlhttpRequest // @grant GM_addStyle // @license GPL-3.0 License // @namespace https://greasyfork.org/users/1118029 // ==/UserScript== (function() { 'use strict'; console.log(1111) async function w(e, t, r=5e3) { return Promise.race([fetch(e, t), new Promise((a,o)=>setTimeout(()=>o(new Error("Request Timeout")), r))]) } async function f(e, t={}) { const {method: r="GET", headers: a={}, body: o, timeout: l} = t; try { const n = await w(e, { method: r, headers: a, body: o }, l); return n.status === 500 || n.status === 404 || n.status === 403 ? Promise.reject(n) : e.includes("getusertorrentlistajax") ? await n.text() : await n.json() } catch (n) { return console.error("Fetch error: ", n), n } } const y = async e=>f(`/api/user-seeding-torrent?page=${e.page}`, { method: "GET" }) , k = e=>{ const t = new FormData; return t.append("action", "addClaim"), t.append("params[torrent_id]", e + ""), f("/ajax.php", { method: "POST", body: t }) } , T = async e=>f(`getusertorrentlistajax.php?page=${e.page}&userid=${e.userid}&type=seeding`, { method: "GET" }) , E = ` .led-box{ position: fixed; top: 80px; left: 20px; z-index: 9999; display:flex; flex-direction: column; align-items: center; justify-content: center; } .led-box li{ color:#fff; background-color: #ff0081; padding:5px; list-style:none; line-height:20px; font-size:14px; } .bubbly-button { font-family: "Helvetica", "Arial", sans-serif; display: inline-block; font-size: 20px; padding: 8px 10px; appearance: none; background-color: #ff0081; color: #fff; border-radius: 4px; border: none; cursor: pointer; position: relative; transition: transform ease-in 0.1s, box-shadow ease-in 0.25s; box-shadow: 0 2px 25px rgba(255, 0, 130, 0.5); } .bubbly-button:focus { outline: 0; } .bubbly-button:before, .bubbly-button:after { position: absolute; content: ""; display: block; width: 140%; height: 100%; left: -20%; z-index: -1000; transition: all ease-in-out 0.5s; background-repeat: no-repeat; } .bubbly-button:before { display: none; top: -75%; background-image: radial-gradient(circle, #ff0081 20%, transparent 20%), radial-gradient(circle, transparent 20%, #ff0081 20%, transparent 30%), radial-gradient(circle, #ff0081 20%, transparent 20%), radial-gradient(circle, #ff0081 20%, transparent 20%), radial-gradient(circle, transparent 10%, #ff0081 15%, transparent 20%), radial-gradient(circle, #ff0081 20%, transparent 20%), radial-gradient(circle, #ff0081 20%, transparent 20%), radial-gradient(circle, #ff0081 20%, transparent 20%), radial-gradient(circle, #ff0081 20%, transparent 20%); background-size: 10% 10%, 20% 20%, 15% 15%, 20% 20%, 18% 18%, 10% 10%, 15% 15%, 10% 10%, 18% 18%; } .bubbly-button:after { display: none; bottom: -75%; background-image: radial-gradient(circle, #ff0081 20%, transparent 20%), radial-gradient(circle, #ff0081 20%, transparent 20%), radial-gradient(circle, transparent 10%, #ff0081 15%, transparent 20%), radial-gradient(circle, #ff0081 20%, transparent 20%), radial-gradient(circle, #ff0081 20%, transparent 20%), radial-gradient(circle, #ff0081 20%, transparent 20%), radial-gradient(circle, #ff0081 20%, transparent 20%); background-size: 15% 15%, 20% 20%, 18% 18%, 20% 20%, 15% 15%, 10% 10%, 20% 20%; } .bubbly-button:active { transform: scale(0.9); background-color: #e60074; box-shadow: 0 2px 25px rgba(255, 0, 130, 0.2); } .bubbly-button.animate:before { display: block; animation: topBubbles ease-in-out 0.75s forwards; } .bubbly-button.animate:after { display: block; animation: bottomBubbles ease-in-out 0.75s forwards; } @keyframes topBubbles { 0% { background-position: 5% 90%, 10% 90%, 10% 90%, 15% 90%, 25% 90%, 25% 90%, 40% 90%, 55% 90%, 70% 90%; } 50% { background-position: 0% 80%, 0% 20%, 10% 40%, 20% 0%, 30% 30%, 22% 50%, 50% 50%, 65% 20%, 90% 30%; } 100% { background-position: 0% 70%, 0% 10%, 10% 30%, 20% -10%, 30% 20%, 22% 40%, 50% 40%, 65% 10%, 90% 20%; background-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%; } } @keyframes bottomBubbles { 0% { background-position: 10% -10%, 30% 10%, 55% -10%, 70% -10%, 85% -10%, 70% -10%, 70% 0%; } 50% { background-position: 0% 80%, 20% 80%, 45% 60%, 60% 100%, 75% 70%, 95% 60%, 105% 0%; } 100% { background-position: 0% 90%, 20% 90%, 45% 70%, 60% 110%, 75% 80%, 95% 70%, 110% 10%; background-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%; } }`; function j(e) { const t = document.createElement("style"); t.textContent = e, document.head.appendChild(t) } function L(e) { var t = new RegExp("(^|\\?|&)" + e + "=([^&]*)(\\s|&|$)","i"); return t.test(location.href) ? unescape(RegExp.$2.replace(/\+/g, " ")) : "" } function P() { if(location.href.includes('leaves.red')){ return Promise.resolve('getusertorrentlistajax') } return new Promise(e=>{ y({ page: 1 }).then(()=>{ e("api") } ).catch(()=>{ e("getusertorrentlistajax") } ) } ) } function v(e) { if (e.preventDefault, e.target && e.target instanceof Element) { const t = e.target; t.classList.remove("animate"), t.classList.add("animate"), setTimeout(()=>{ t.classList.remove("animate") } , 700) } } async function x(e) { try { return await y({ page: e }) } catch (t) { throw console.error("getUserTorrent error: ", t), new Error("查询用户领种信息异常") } } async function C(e, t) { try { return await T({ page: e, userid: t }) } catch (r) { throw console.error("getUsertorrentlistajax error: ", r), new Error("查询用户领种信息异常") } } async function $(e, t) { const r = {}; for (let a = 0; a < e.length; a++) { t.innerHTML = `努力再努力 ${e.length} / ${a + 1}`; let o = await k(e[a].id); r[o.msg] || (r[o.msg] = 0), r[o.msg] += 1 } return r } let e = !1; const t = document.createElement("button") , r = document.createElement("ul"); j(E), t.className = "bubbly-button"; const a = document.createElement("div"); a.className = "led-box", t.addEventListener("click", async o=>{ if (e) return; e = !0, t.innerText = "尝试多种方案请求中~~~"; const l = await P(); t.innerText = "开始工作,为了网站和你自己的电脑速度调的很慢~~~"; const n = []; try { v(o); let s = 1; if (l === "api") { const i = await x(s); for (n.push(...i.data || []); i?.meta && i.meta.total > n.length; ) { s++; const c = await x(s); c?.data && n.push(...c.data) } } if (l === "getusertorrentlistajax") { const i = L("id") , c = [] , b = async g=>{ const m = await C(g, i) , h = /data-torrent_id="(\d+)"/g; let d; for (; (d = h.exec(m)) !== null; ) !c.includes(d[1]) && n.push({ id: d[1] }), c.push(d[1]); h.exec(m) !== null && await b(g + 1) } ; await b(0) } if (!n.length) { t.innerText = "该站点可能不支持领种子。"; return } const u = await $(n, t); console.log("msglist: ", u); let p = ""; Object.keys(u).forEach(i=>{ p += `<li>${i}: ${u[i]}</li>` } ), t.innerText = "一键认领完毕,刷新查看。", r.innerHTML = p } catch (s) { console.error("Error: ", s), t.innerText = s.message } finally { e = !1 } }), t.innerText = "一键认领", a.appendChild(t), a.appendChild(r), document.body.appendChild(a) // Your code here... })();