NP一键认领

适用于NP架构的一键认领

  1. // ==UserScript==
  2. // @name NP一键认领
  3. // @name:en NP torrents claim
  4. // @namespace http://star-space.net/
  5. // @version 0.0.1
  6. // @description 适用于NP架构的一键认领
  7. // @description:en one key claim all the seeding torrents for NesusPHP.
  8. // @author Lancertony
  9. // @match https://star-space.net/userdetails.php?id=*
  10. // @match https://1ptba.com/userdetails.php?id=*
  11. // @match https://pt.btschool.club/userdetails.php?id=*
  12. // @match https://carpt.net/userdetails.php?id=*
  13. // @match https://cyanbug.net/userdetails.php?id=*
  14. // @match https://hdfans.org/userdetails.php?id=*
  15. // @match https://hdvideo.one/userdetails.php?id=*
  16. // @match https://hdtime.org/userdetails.php?id=*
  17. // @match https://hdpt.xyz/userdetails.php?id=*
  18. // @match https://hdatmos.club/userdetails.php?id=*
  19. // @match https://pt.0ff.cc/userdetails.php?id=*
  20. // @match https://discfan.net/userdetails.php?id=*
  21. // @match https://zmpt.cc/userdetails.php?id=*
  22. // @match https://wintersakura.net/userdetails.php?id=*
  23. // @match https://pt.soulvoice.club/userdetails.php?id=*
  24. // @match https://piggo.me/userdetails.php?id=*
  25. // @match https://www.pthome.net/userdetailspage.php?userid=*
  26. // @match https://kamept.com/userdetails.php?id=*
  27. // @match https://audiences.me/userdetails.php?id=*
  28. // @match https://dajiao.cyou/userdetails.php?id=*
  29. // @match https://springsunday.net/userdetails.php?id=*
  30. // @match https://star-space.net/claim.php?uid=*
  31. // @license MIT
  32. // @grant unsafeWindow
  33. // ==/UserScript==
  34.  
  35. /**
  36. * 改自KamePT一键认领, 原网址: https://gf.qytechs.cn/zh-CN/scripts/434757-烧包一键认领
  37. * 理论上NP架构的都可以用
  38. * 增加个别站点的一键取消认领
  39. */
  40.  
  41. (function () {
  42. 'use strict';
  43.  
  44. // Your code here...
  45. function sleep(time) {
  46. return new Promise((resolve) => setTimeout(resolve, time)).catch((e) => { console.log(e); });
  47. }
  48.  
  49. window.onload = function () {
  50. if (location.href.match(/^https:\/\/star-space.net\/claim.php/)) {
  51. var claimBtn = document.getElementById("declaimAllTorrents");
  52. if (claimBtn == null) {
  53. const dom = document.createElement('div');
  54. dom.innerHTML = '<div id="declaimAllTorrents"><button class="bg-[#CDAE9C] rounded-sm w-[50px] h-[24px]" onclick="window.deClaimTorrents();" style="width: 120px;"><img style="margin-right: 4px;" class="staff_delete" src="pic/trans.gif">一键取消认领</button></div>';
  55. document.getElementById("claim-table").prepend(dom);
  56. }
  57. } else {
  58. var rows = document.querySelectorAll("tr");//tr表行元素,获取所有表行
  59. for (var i = 0; i < rows.length; i++) {
  60. if (rows[i].childElementCount == 2 && rows[i].cells[0].innerText == "当前做种") {//如果该表行只有两个子元素且第一个子元素的内部文本为“当前做种”
  61. var idClaim = document.getElementById("claimAllTorrents");//获取所有ID为的claimAllTorrents的元素
  62. if (idClaim == null) {//如果为空,则创建一键认领按钮
  63. const dom = document.createElement('div');
  64. dom.innerHTML = '<a id="claimAllTorrents" href="javascript:void(0);" onclick="window.manualClaimTorrents();" style="margin-left:10px;font-weight:bold;color:red" title="认领全部当前做种(运行后无法停止,强制停止可关闭页面)">一键认领</a>';
  65. rows[i].cells[1].prepend(dom)
  66. break;
  67. }
  68. }
  69. }
  70. }
  71. }
  72.  
  73. unsafeWindow.deClaimTorrents = async function() {
  74. const _raw_list = Array.from(document.querySelectorAll('button[data-action="removeClaim"]'));
  75. const list = _raw_list.filter(el => el.style.display != 'none');
  76. console.log(list);
  77. if (list.length == 0) {
  78. alert('未检测到可取消认领的种子\n若列表没有种子您无法取消认领!')
  79. return
  80. }
  81. var msg = "确定要取消认领本页全部种子吗?\n\n严正警告: \n请勿短时间内多次点击, 否则后果自负!\n取消认领可能会被扣除魔力!请一定要考虑清楚! \n点击后请等待至弹窗, 种子越多越要等捏O(∩_∩)O(每个种子访问间隔500ms)";
  82. if (confirm(msg) == true) {
  83. await unsafeWindow.ClassificationDeClaimTorrents(list);
  84. }
  85. var total = result.total;
  86. var success = result.success;
  87. alert(`共计${total}个种子,本次取消认领${success}个,即将刷新页面。`);
  88. location.reload();
  89. }
  90.  
  91. unsafeWindow.ClassificationDeClaimTorrents = async function (element) {
  92. var total = 0, success = 0;
  93. for (const el of element) {
  94. total += 1;
  95. var claimId = el.dataset.claim_id;
  96. if (claimId > 0) {
  97. var xhr = new XMLHttpRequest();
  98. var params = 'action=removeClaim&params%5Bid%5D=';
  99. var endpoint = '';
  100. if (location.href.match(/^https:\/\/star-space.net\//)) {
  101. endpoint = 'https://star-space.net/ajax.php';
  102. }
  103. xhr.open('POST', endpoint, true);
  104. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  105. xhr.send(params + claimId);
  106. }
  107.  
  108. xhr.onload = function () {
  109. if (xhr.status == 200) {
  110. // response 就是你要的东西
  111. var response = xhr.responseText
  112. el.style.background = 'lime';
  113. el.innerText = '成功';
  114.  
  115. console.log(response)
  116.  
  117. success += 1;
  118. }
  119. }
  120.  
  121. await sleep(100);
  122. }
  123. return {
  124. total: total,
  125. success: success
  126. }
  127. }
  128.  
  129. unsafeWindow.getRawList = function () {
  130. if (location.href.match(/^https:\/\/audiences.me\//)) {
  131. return Array.from(document.querySelectorAll('a[href^="javascript:claim(\'add\'"]'));
  132. } else if (location.href.match(/^https:\/\/springsunday.net\//)) {
  133. return Array.from(document.querySelectorAll('button[onclick^="adopt_new"]'));
  134. } else {
  135. return Array.from(document.querySelectorAll("button[data-action='addClaim']"));
  136. }
  137. }
  138.  
  139. unsafeWindow.manualClaimTorrents = async function () {
  140. const _raw_list = unsafeWindow.getRawList();
  141. const list = _raw_list.filter(el => el.style.display != 'none');//获取所有a元素
  142. console.log(list);
  143. if (list.length == 0) {
  144. alert('未检测到已做种种子或已经全部认领\n请打开当前做种列表, 若列表没有种子您无法认领!\n若您已经全部认领请无视!')
  145. return
  146. }
  147.  
  148. var msg = "确定要认领本页全部种子吗?\n\n严正警告: \n请勿短时间内多次点击, 否则后果自负!\n请勿短时间内多次点击, 否则后果自负!\n请勿短时间内多次点击, 否则后果自负! \n点击后请等待至弹窗, 种子越多越要等捏O(∩_∩)O(每个种子访问间隔500ms)";
  149. if (confirm(msg) == true) {//提示选择确认
  150. var maxClaim = 10000;
  151. var result = {};
  152. if (location.href.match(/^https:\/\/audiences.me\//)) {
  153. result = await unsafeWindow.AudiencesClaimTorrents(list, maxClaim);
  154. } else {
  155. result = await unsafeWindow.ClassificationClaimTorrents(list, maxClaim);
  156. }
  157. var total = result.total;
  158. var success = result.success;
  159. alert(`共计${total}个种子,本次成功认领${success}个。`);
  160. }
  161. }
  162.  
  163. unsafeWindow.AudiencesClaimTorrents = async function (element, maxClaim) {
  164. var total = 0, success = 0;
  165. for (const el of element) {
  166. if (success >= maxClaim) {
  167. alert("最多只能认领10000个种子!");
  168. break;
  169. }
  170. total += 1;
  171. var strs = el.pathname.split(',');
  172. const claimId = strs[1].substring(1, strs[1].length-1);
  173. if (claimId > 0) {
  174. var xhr = new XMLHttpRequest();
  175. var params = 'act=add&tid=' + claimId;
  176. var endpoint = 'claim.php?'+ params;
  177. xhr.open('GET', endpoint, true);
  178. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  179. xhr.send(params);
  180. }
  181.  
  182. xhr.onload = function () {
  183. if (xhr.status == 200) {
  184. // response 就是你要的东西
  185. var response = xhr.responseText
  186. el.style.background = 'lime';
  187. el.innerText = '成功';
  188.  
  189. console.log(response)
  190.  
  191. success += 1;
  192. }
  193. }
  194.  
  195. await sleep(500);
  196. }
  197. return {
  198. total: total,
  199. success: success
  200. }
  201. }
  202.  
  203. unsafeWindow.ClassificationClaimTorrents = async function (element, maxClaim) {
  204. var total = 0, success = 0;
  205. for (const el of element) {
  206. if (success >= maxClaim) {
  207. alert("最多只能认领10000个种子!");
  208. break;
  209. }
  210. total += 1;
  211. var claimId = el.dataset.torrent_id;
  212. if (location.href.match(/^https:\/\/springsunday.net\//)) {
  213. claimId = el.id.substring(3);
  214. }
  215. if (claimId > 0) {
  216. var xhr = new XMLHttpRequest();
  217. var params = 'action=addClaim&params%5Btorrent_id%5D=';
  218. var endpoint = '';
  219. if (location.href.match(/^https:\/\/star-space.net\//)) {
  220. endpoint = 'https://star-space.net/ajax.php';
  221. } else if (location.href.match(/^https:\/\/1ptba.com\//)) {
  222. endpoint = 'https://1ptba.com/ajax.php';
  223. } else if (location.href.match(/^https:\/\/pt.btschool.club\//)) {
  224. endpoint = 'https://pt.btschool.club/ajax.php';
  225. } else if (location.href.match(/^https:\/\/carpt.net\//)) {
  226. endpoint = 'https://carpt.net/ajax.php';
  227. } else if (location.href.match(/^https:\/\/cyanbug.net\//)) {
  228. endpoint = 'https://cyanbug.net/ajax.php';
  229. } else if (location.href.match(/^https:\/\/hdfans.org\//)) {
  230. endpoint = 'https://hdfans.org/ajax.php';
  231. } else if (location.href.match(/^https:\/\/hdvideo.one\//)) {
  232. endpoint = 'https://hdvideo.one/ajax.php';
  233. } else if (location.href.match(/^https:\/\/hdtime.org\//)) {
  234. endpoint = 'https://hdtime.org/ajax.php';
  235. } else if (location.href.match(/^https:\/\/hdpt.xyz\//)) {
  236. endpoint = 'https://hdpt.xyz/ajax.php';
  237. } else if (location.href.match(/^https:\/\/hdatmos.club\//)) {
  238. endpoint = 'https://hdatmos.club/ajax.php';
  239. } else if (location.href.match(/^https:\/\/pt.0ff.cc\//)) {
  240. endpoint = 'https://pt.0ff.cc/ajax.php';
  241. } else if (location.href.match(/^https:\/\/discfan.net\//)) {
  242. endpoint = 'https://discfan.net/ajax.php';
  243. } else if (location.href.match(/^https:\/\/zmpt.cc\//)) {
  244. endpoint = 'https://zmpt.cc/ajax.php';
  245. } else if (location.href.match(/^https:\/\/wintersakura.net\//)) {
  246. endpoint = 'https://wintersakura.net/ajax.php';
  247. } else if (location.href.match(/^https:\/\/pt.soulvoice.club\//)) {
  248. endpoint = 'https://pt.soulvoice.club/ajax.php';
  249. } else if (location.href.match(/^https:\/\/piggo.me\//)) {
  250. endpoint = 'https://piggo.me/ajax.php';
  251. } else if (location.href.match(/^https:\/\/www.pthome.net\//)) {
  252. endpoint = 'https://www.pthome.net/ajax.php';
  253. } else if (location.href.match(/^https:\/\/kamept.com\//)) {
  254. endpoint = 'https://kamept.com/ajax.php';
  255. } else if (location.href.match(/^https:\/\/dajiao.cyou\//)) {
  256. endpoint = 'https://dajiao.cyou/ajax.php';
  257. } else if (location.href.match(/^https:\/\/springsunday.net\//)) {
  258. endpoint = 'https://springsunday.net/adopt.php';
  259. params = 'action=add&id=';
  260. }
  261. xhr.open('POST', endpoint, true);
  262. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  263. xhr.send(params + claimId);
  264. }
  265.  
  266. xhr.onload = function () {
  267. if (xhr.status == 200) {
  268. // response 就是你要的东西
  269. var response = xhr.responseText
  270. el.style.background = 'lime';
  271. el.innerText = '成功';
  272.  
  273. console.log(response)
  274.  
  275. success += 1;
  276. }
  277. }
  278.  
  279. await sleep(100);
  280. }
  281. return {
  282. total: total,
  283. success: success
  284. }
  285. }
  286. })();

QingJ © 2025

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