提取百度网盘链接和提取码(追新番专用)

一键提取追新番网页中的百度网盘链接和提取码,用于批量转存,支持一键复制

  1. // ==UserScript==
  2. // @name 提取百度网盘链接和提取码(追新番专用)
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.3
  5. // @description 一键提取追新番网页中的百度网盘链接和提取码,用于批量转存,支持一键复制
  6. // @author CNOS
  7. // @match https://*.fanxinzhui.com/rr/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // 提取百度网盘链接和提取码的函数
  15. function extractBaiduLinks() {
  16. const links = document.querySelectorAll('a[href*="pan.baidu.com/s/"]');
  17. const results = [];
  18.  
  19. links.forEach(link => {
  20. const href = link.getAttribute('href');
  21. const passwordElement = link.parentElement.querySelector('.password');
  22. const password = passwordElement ? passwordElement.textContent.trim() : '';
  23.  
  24. if (href && password) {
  25. results.push(`${href} ${password}`);
  26. }
  27. });
  28.  
  29. return results;
  30. }
  31.  
  32. // 创建一个按钮用于触发提取操作
  33. const button = document.createElement('button');
  34. button.textContent = '提取百度网盘链接';
  35. button.style.position = 'fixed';
  36. button.style.top = '10px';
  37. button.style.right = '10px';
  38. button.style.zIndex = '999999';
  39. button.style.padding = '5px 10px';
  40. button.style.fontSize = '14px';
  41. button.style.backgroundColor = '#4CAF50';
  42. button.style.color = 'white';
  43. button.style.border = 'none';
  44. button.style.borderRadius = '5px';
  45. button.style.cursor = 'pointer';
  46.  
  47. // 添加按钮点击事件
  48. button.addEventListener('click', () => {
  49. const links = extractBaiduLinks();
  50. if (links.length === 0) {
  51. alert('未找到百度网盘链接!');
  52. return;
  53. }
  54.  
  55. // 在原页面中显示结果
  56. const resultDiv = document.createElement('div');
  57. resultDiv.id = 'extracted-links';
  58. resultDiv.style.position = 'fixed';
  59. resultDiv.style.top = '60px';
  60. resultDiv.style.right = '10px';
  61. resultDiv.style.width = '300px';
  62. resultDiv.style.height = 'auto';
  63. resultDiv.style.backgroundColor = '#f9f9f9';
  64. resultDiv.style.padding = '10px';
  65. resultDiv.style.border = '1px solid #ccc';
  66. resultDiv.style.borderRadius = '5px';
  67. resultDiv.style.boxShadow = '0 2px 5px rgba(0,0,0,0.2)';
  68. resultDiv.style.zIndex = '999998';
  69.  
  70. const resultText = document.createElement('pre');
  71. resultText.textContent = links.join('\n');
  72. resultText.style.whiteSpace = 'pre-wrap';
  73. resultText.style.wordWrap = 'break-word';
  74.  
  75. const copyButton = document.createElement('button');
  76. copyButton.textContent = '一键复制';
  77. copyButton.style.display = 'block';
  78. copyButton.style.margin = '10px 0';
  79. copyButton.style.padding = '5px 10px';
  80. copyButton.style.fontSize = '14px';
  81. copyButton.style.backgroundColor = '#007bff';
  82. copyButton.style.color = 'white';
  83. copyButton.style.border = 'none';
  84. copyButton.style.borderRadius = '5px';
  85. copyButton.style.cursor = 'pointer';
  86.  
  87. // 复制功能实现(使用现代剪贴板 API)
  88. copyButton.addEventListener('click', async () => {
  89. try {
  90. await navigator.clipboard.writeText(links.join('\n'));
  91. alert('已复制到剪贴板!');
  92. } catch (err) {
  93. console.error('复制失败:', err);
  94. alert('复制失败,请手动复制内容。');
  95. }
  96. });
  97.  
  98. resultDiv.appendChild(resultText);
  99. resultDiv.appendChild(copyButton);
  100. document.body.appendChild(resultDiv);
  101. });
  102.  
  103. // 将按钮添加到页面中
  104. document.body.appendChild(button);
  105. })();

QingJ © 2025

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