auto-open-sheet

自动打开当前页的种子!,配合auto-say-hello-plus插件有意想不到的效果!如果未匹配成功请联系我:960487551@qq.com

当前为 2025-05-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name auto-open-sheet
  3. // @namespace http://tampermonkey.net/
  4. // @description:zh-CN 自动打开当前页的种子!,配合auto-say-hello-plus插件有意想不到的效果!如果未匹配成功请联系我:960487551@qq.com
  5. // @description:en Automatically open the torrent on the current page! Combined with the auto-say-hello-plus plugin, it delivers unexpected results! If it fails to match successfully, please contact me: 960487551@qq.com
  6. // @license MIT
  7. // @author wiiii
  8. // @version 1.0.3
  9. // @email 960487551@qq.com
  10. // @copyright (c) 2025-01-01
  11. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  12. // @match *://pt.m-team.cc/*torrents.php*
  13. // @match *://kp.m-team.cc/*torrents.php*
  14. // @match *://xp.m-team.io/*torrents.php*
  15. // @match *://pt.btschool.club/torrents.php*
  16. // @match *://www.haidan.video/torrents.php*
  17. // @match *://www.hddolby.com/torrents.php*
  18. // @match *://www.hdarea.co/torrents.php*
  19. // @match *://hdatmos.club/torrents.php*
  20. // @match *://hdhome.org/torrents.php*
  21. // @match *://hdsky.me/torrents.php*
  22. // @match *://hdtime.org/torrents.php*
  23. // @match *://hhanclub.top/torrents.php*
  24. // @match *://lemonhd.org/details*
  25. // @match *://pt.soulvoice.club/torrents.php*
  26. // @match *://avgv.cc/torrents.php*
  27. // @match *://ptsbao.club/torrents.php*
  28. // @match *://www.beitai.pt/torrents.php*
  29. // @match *://et8.org/torrents.php*
  30. // @match *://pt.eastgame.org/torrents.php*
  31. // @match *://pthome.net/torrents.php*
  32. // @match *://pterclub.com/torrents.php*
  33. // @match *://ourbits.club/torrents.php*
  34. // @match *://hdzone.me/torrents.php*
  35. // @match *://pt.msg.vg/torrents.php*
  36. // @match *://hdfans.org/torrents.php*
  37. // @match *://rousi.zip/torrents.php*
  38. // @match *://carpt.net/torrents.php*
  39. // @match *://www.tjupt.org/torrents.php*
  40. // @match *://yingk.com/torrents.php*
  41. // @match *://www.dragonhd.xyz/torrents.php*
  42. // @match *://chdbits.co/torrents.php*
  43. // @match *://www.nicept.net/torrents.php*
  44. // @match *://tmpt.top/torrents.php*
  45. // @match *://open.cd/torrents.php*
  46. // @grant none
  47. // @description 化身西部hello哥亚瑟摩根,对每个种子页面都自动感谢!如果未匹配成功请联系我:960487551@qq.com
  48. // ==/UserScript==
  49.  
  50.  
  51. (function () {
  52. 'use strict';
  53.  
  54. // 配置参数
  55. const maxLinksToOpen = 50; // 最多同时打开的链接数
  56. const minIntervalTime = 100; // 每次打开的最小间隔(毫秒)
  57. const maxIntervalTime = 300; // 每次打开的最大间隔(毫秒)
  58. const storageKey = 'openedLinks'; // localStorage 键名,用于记录已打开的链接
  59. const userPromptKey = 'userPrompt'; // localStorage 键名,用于记录用户选择和时间
  60. const regex = /details\.php\?id=(\d+)/; // 链接匹配规则
  61.  
  62. // 辅助函数:获取当前时间的时间戳
  63. function getCurrentTimestamp() {
  64. return new Date().getTime(); // 获取时间戳(毫秒)
  65. }
  66.  
  67. // 辅助函数:获取用户提示记录
  68. function getUserPromptRecord() {
  69. return JSON.parse(localStorage.getItem(userPromptKey));
  70. }
  71.  
  72. // 辅助函数:保存用户提示记录
  73. function saveUserPromptRecord(confirmed) {
  74. const record = {
  75. confirmed, // 用户选择:true 表示确认开启,false 表示取消
  76. timestamp: getCurrentTimestamp() // 当前时间
  77. };
  78. localStorage.setItem(userPromptKey, JSON.stringify(record));
  79. }
  80.  
  81. // 辅助函数:获取已打开链接记录
  82. function getOpenedLinks() {
  83. return JSON.parse(localStorage.getItem(storageKey)) || [];
  84. }
  85.  
  86. // 辅助函数:保存已打开链接记录
  87. function saveOpenedLinks(openedLinks) {
  88. localStorage.setItem(storageKey, JSON.stringify(openedLinks));
  89. }
  90.  
  91. // 辅助函数:在右上角显示提示信息
  92. function showNotification(message) {
  93. // 创建提示框容器
  94. const notification = document.createElement('div');
  95. notification.textContent = message;
  96. notification.style.position = 'fixed';
  97. notification.style.top = '20px';
  98. notification.style.right = '20px';
  99. notification.style.zIndex = '9999';
  100. notification.style.backgroundColor = '#007bff';
  101. notification.style.color = '#fff';
  102. notification.style.padding = '10px 20px';
  103. notification.style.borderRadius = '5px';
  104. notification.style.boxShadow = '0 4px 6px rgba(0, 0, 0, 0.1)';
  105. notification.style.fontFamily = 'Arial, sans-serif';
  106. notification.style.fontSize = '14px';
  107.  
  108. // 添加到页面中
  109. document.body.appendChild(notification);
  110.  
  111. // 设置定时器,3秒后自动移除提示
  112. setTimeout(() => {
  113. notification.remove();
  114. }, 3000);
  115. }
  116.  
  117. // 主逻辑:后台打开符合条件的链接
  118. function startOpeningLinks() {
  119. const openedLinks = getOpenedLinks(); // 获取已打开的链接记录
  120. const links = document.querySelectorAll('a'); // 获取页面中所有的 <a> 标签
  121.  
  122. // 筛选出符合条件的链接
  123. const matchedLinks = [];
  124. links.forEach(link => {
  125. const href = link.getAttribute('href');
  126. if (href && regex.test(href)) {
  127. const match = href.match(regex);
  128. const id = match[1]; // 提取链接中的 ID
  129. const domainWithId = `${location.hostname}:${id}`; // 组合为 "域名:ID"
  130.  
  131. if (!openedLinks.includes(domainWithId)) {
  132. matchedLinks.push({ link, domainWithId }); // 存储符合条件的链接和 ID
  133. }
  134. }
  135. });
  136.  
  137. if (matchedLinks.length === 0) {
  138. // 当前页面所有链接都已访问过,右上角提示用户打开下一页
  139. showNotification('当前页面的所有链接都已打开,请打开下一页!');
  140. console.log('%c 当前页面的所有链接都已打开,请打开下一页!', 'color: orange;');
  141. return;
  142. }
  143.  
  144. console.log(`%c 找到 ${matchedLinks.length} 个符合条件的未访问链接,最多打开 ${maxLinksToOpen} 个。`, 'color: blue;');
  145. console.table(matchedLinks);
  146.  
  147. // 限制最多打开的链接数量
  148. const linksToOpen = matchedLinks.slice(0, maxLinksToOpen);
  149.  
  150. let index = 0;
  151.  
  152. // 递归方式逐一打开链接
  153. function openNextLink() {
  154. if (index >= linksToOpen.length) {
  155. console.log('%c 所有链接已按设置打开,任务完成。', 'color: green;');
  156. return; // 所有链接已打开,退出递归
  157. }
  158.  
  159. const { link, domainWithId } = linksToOpen[index];
  160.  
  161. try {
  162. // 使用 window.open 打开链接,并确保当前页面视角不切换
  163. window.open(link.href, '_blank', 'noopener,noreferrer');
  164. console.log(`%c 成功后台打开链接 (${index + 1}/${linksToOpen.length}): ${link.href}`, 'color: green;');
  165.  
  166. // 记录已打开链接
  167. openedLinks.push(domainWithId);
  168. saveOpenedLinks(openedLinks);
  169. } catch (error) {
  170. console.log(`%c 打开链接失败 (${index + 1}/${linksToOpen.length}): ${link.href}`, 'color: red;', error);
  171. }
  172.  
  173. index++; // 处理下一个链接
  174.  
  175. // 随机设置下一个打开的时间间隔
  176. const randomInterval = Math.floor(Math.random() * (maxIntervalTime - minIntervalTime + 1)) + minIntervalTime;
  177. console.log(`%c 下一个链接将在 ${randomInterval / 1000} 秒后尝试打开。`, 'color: orange;');
  178.  
  179. setTimeout(openNextLink, randomInterval); // 递归调用
  180. }
  181.  
  182. // 开始递归调用
  183. openNextLink();
  184. }
  185.  
  186. // 页面加载时执行主逻辑
  187. window.onload = function () {
  188. const record = getUserPromptRecord();
  189.  
  190. // 如果用户已开启功能,直接执行打开链接逻辑
  191. if (record && record.confirmed) {
  192. console.log('%c 功能已开启,直接执行打开链接逻辑。', 'color: green;');
  193. startOpeningLinks();
  194. } else {
  195. // 如果记录为 null,提示用户是否开启功能
  196. if (record === null) {
  197. const userResponse = confirm("是否开启自动打开链接的功能?");
  198. saveUserPromptRecord(userResponse); // 保存用户选择
  199.  
  200. if (userResponse) {
  201. console.log('%c 用户选择开启功能,直接执行打开链接逻辑。', 'color: green;');
  202. startOpeningLinks();
  203. } else {
  204. console.log('%c 用户选择不开启功能,跳过打开链接逻辑。', 'color: orange;');
  205. }
  206. } else {
  207. console.log('%c 功能未开启,跳过打开链接逻辑。', 'color: orange;');
  208. }
  209. }
  210. };
  211. })();
  212.  
  213.  
  214.  
  215.  

QingJ © 2025

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