Greasy Fork 支持简体中文。

百度网盘SVIP高速解析直链的不限速下载助手-文武PanDownload

不限制速度的百度网盘SVIP解析高速直链的脚本助手,无视黑号,100%可用,下载速度最快可达10M+/s,支持 Gopeed(一键解析)、IDM、NDM 等多线程极速下载工具,支持 Microsoft Edge、Google Chrome、Firefox 等浏览器。

目前為 2024-12-19 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name 百度网盘SVIP高速解析直链的不限速下载助手-文武PanDownload
  3. // @namespace https://github.com/dongyubin/Baidu-VIP
  4. // @version 3.4
  5. // @description 不限制速度的百度网盘SVIP解析高速直链的脚本助手,无视黑号,100%可用,下载速度最快可达10M+/s,支持 Gopeed(一键解析)、IDM、NDM 等多线程极速下载工具,支持 Microsoft Edge、Google Chrome、Firefox 等浏览器。
  6. // @author dongyubin
  7. // @homepage https://fk.wwkejishe.top/buy/23
  8. // @supportURL https://fk.wwkejishe.top/buy/23
  9. // @license MIT
  10. // @icon https://fk.wwkejishe.top/uploads/images/6e798005b00ce678782af4e6931f4374.png
  11. // @resource layuiCSS https://cdnjs.cloudflare.com/ajax/libs/layui/2.9.20/css/layui.min.css
  12. // @require https://cdnjs.cloudflare.com/ajax/libs/layui/2.9.20/layui.min.js
  13. // @require https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js
  14. // @match *://pan.baidu.com/*
  15. // @match *://yun.baidu.com/*
  16. // @match *://pan.baidu.com/disk/home*
  17. // @match *://yun.baidu.com/disk/home*
  18. // @match *://pan.baidu.com/disk/timeline*
  19. // @match *://yun.baidu.com/disk/timeline*
  20. // @match *://pan.baidu.com/disk/main*
  21. // @match *://yun.baidu.com/disk/main*
  22. // @match *://pan.baidu.com/disk/base*
  23. // @match *://yun.baidu.com/disk/base*
  24. // @match *://pan.baidu.com/s/*
  25. // @match *://yun.baidu.com/s/*
  26. // @match *://pan.baidu.com/aipan/*
  27. // @match *://yun.baidu.com/aipan/*
  28. // @match *://pan.baidu.com/share/*
  29. // @match *://yun.baidu.com/share/*
  30. // @match *://openapi.baidu.com/*
  31. // @connect aifenxiang.net.cn
  32. // @connect baidu.com
  33. // @connect *
  34. // @connect 127.0.0.1
  35. // @grant GM_cookie
  36. // @grant GM_addStyle
  37. // @grant GM_getResourceText
  38. // @grant GM_xmlhttpRequest
  39. // @grant GM_setClipboard
  40. // @grant GM_notification
  41. // @grant GM_info
  42. // @antifeature ads
  43. // @antifeature membership
  44. // @antifeature referral-link
  45. // ==/UserScript==
  46. (function () {
  47. 'use strict';
  48. const layuiCss = GM_getResourceText('layuiCSS');
  49. GM_addStyle(layuiCss + `
  50. .layui-icon-close:before {
  51. content: "x" !important;
  52. }
  53. `);
  54. const wwConfig = {
  55. mainUrl: 'https://aifenxiang.net.cn:8081',
  56. bdPassword: '1234',
  57. titleName: '文武PanDownload',
  58. goPeedTaskUrl: 'http://127.0.0.1:9999/api/v1/tasks',
  59. ua: 'netdisk;1.0.1',
  60. one_parse: {
  61. code: 'bd-2',
  62. version: '1.1.4'
  63. },
  64. wx_parse: {
  65. version: "1.0.9"
  66. }
  67. };
  68. layui.use(['layer'], async function () {
  69. var layer = layui.layer,
  70. $ = layui.$;
  71. var form = layui.form;
  72. if (location.href.startsWith('https://pan.baidu.com/s/')) {
  73. $('.x-button-box').prepend(
  74. '<a class="g-button" id="downbtn_share" style="background-color: #6800ff;color: #fff;border:none;" href="javascript:;" ><span class="g-button-right"><em style="top:0;" class="icon icon-download" title=""></em><lable class="text" style="width: auto;">' +
  75. wwConfig.titleName +
  76. '</lable></span></a>'
  77. );
  78. } else {
  79. if ($('.tcuLAu').is('*')) {
  80. $('.tcuLAu').prepend(
  81. '<span class="g-dropdown-button"><a id="downbtn_main" style=" margin-right: 10px;color: #fff;background-color: #fc5531;border:none;" id="downbtn_main" class="g-button" ><span class="g-button-right"><em style="top:0;" class="icon icon-download" ></em><lable class="text" style="width: auto;">' +
  82. wwConfig.titleName +
  83. '</lable></span></a></span>'
  84. );
  85. } else {
  86. $('.wp-s-agile-tool-bar__header.is-header-tool').prepend(
  87. '<div class="wp-s-agile-tool-bar__h-group"><button style=" margin-right: 10px;color: #fff;background-color: #ff436a;border:none;" id="downbtn_main" class="u-button nd-file-list-toolbar-action-item" ><i style="top:0;" class="iconfont icon-download"></i> <lable>' +
  88. wwConfig.titleName +
  89. '</lable></button></div>'
  90. );
  91. }
  92. }
  93. $('#downbtn_share').click(function () {
  94. swal({
  95. title: '提示',
  96. text: '请先保存到自己的网盘后,在网盘里解析下载!',
  97. icon: 'warning',
  98. });
  99. return false;
  100. });
  101. $('#downbtn_main').click(function () {
  102. let select = selectList();
  103. let selected = Object.keys(select);
  104. if (selected.length == 0) {
  105. swal({
  106. text: '请先选择一个文件',
  107. icon: 'warning',
  108. });
  109. return false;
  110. } else if (selected.length > 1) {
  111. swal({
  112. text: '目前仅支持单个文件解析',
  113. icon: 'warning',
  114. });
  115. return false;
  116. } else if (select[selected[0]].isdir == 1) {
  117. swal({
  118. text: '目前不支持文件夹解析',
  119. icon: 'warning',
  120. });
  121. return false;
  122. }
  123.  
  124. const openInfoLayer = layer.open({
  125. type: 1,
  126. area: ['550px', 'auto'],
  127. title: '提示',
  128. type: 1,
  129. shade: 0.6,
  130. shadeClose: true,
  131. anim: 0,
  132. content: `
  133. <div class="layui-tab layui-tab-brief" style="background-color: #f8f8f8; border-radius: 8px;">
  134. <ul class="layui-tab-title" style="background-color: #fff; border-bottom: 1px solid #e6e6e6;">
  135. <li class="layui-this">免费解析</li>
  136. <li>验证码解析</li>
  137. <li>稳定解析</li>
  138. <li>防止失联</li>
  139. </ul>
  140. <div class="layui-tab-content" style="padding: 20px;">
  141. <div class="layui-tab-item layui-show">
  142. <div class="layui-form" lay-filter="filter-test-layer" style="width:360px;margin: 16px auto 0; background-color: #fff; border-radius: 8px; padding: 20px;">
  143. <div class="demo-send-container">
  144. <div>
  145. <p>插件解析限制 <span class="piao">2</span> 次</p>
  146. <p>
  147. ⚠️❗ Gopeed 下载器一定要配置好 User-Agent 和端口: <a style="color:red;" target="_blank" href="https://flowus.cn/share/c68e3c55-67e5-460f-b937-7727e0378a34?code=BCRWJL">点击查看 Gopeed 配置教程说明</a>
  148. </p>
  149. <p>
  150. 不限次数 PC 网页稳定版: <a style="color:red;font-weight:900;" target="_blank" href="https://pandown.mlover.site/">点击前往</a>
  151. </p>
  152. </div>
  153. <div class="layui-btn-container">
  154. <button style="margin-top:30px; border-radius: 8px;" id="copyUaBtn" class="layui-btn layui-btn-fluid layui-bg-orange" lay-submit lay-filter="copy-ua">复制User-Agent</button>
  155. <button style="margin-left:0;margin-top:10px; border-radius: 8px;" id="parseBtn" class="layui-btn layui-btn-fluid" lay-submit lay-filter="demo-send">发送到Gopeed</button>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. <div class="layui-tab-item" style="background-color: #fff; border-radius: 8px; padding: 20px;text-align: center;">
  161. <div>
  162. <img src="https://cdn.wwkejishe.top/wp-cdn-02/2024/202411171346351.webp" style="width:240px;height:240px;">
  163. </div>
  164. <h2 class="h2" style="margin-top: 10px;">扫描上方二维码,获取验证码</h2>
  165. <h3>每天随机解析5-10次</h3>
  166. <div>
  167. <input type="text" name="captcha" id="captcha" value="" lay-verify="required" placeholder="请填写验证码" lay-reqtext="请填写验证码" autocomplete="off" class="layui-input" lay-affix="clear">
  168. </div>
  169. <button style="margin-left:0;margin-top:10px; border-radius: 8px;" id="parseWxBtn" class="layui-btn layui-btn-fluid" lay-submit lay-filter="demo-wx-send">发送到Gopeed</button>
  170. </div>
  171. <div class="layui-tab-item" style="background-color: #fff; border-radius: 8px; padding: 20px;">
  172. <p><span style="font-weight: 900;">`+ GM_info.script.name + `</span> 最新的脚本版本号为:<span style="font-weight: 900;">` + GM_info.script.version + `</span></p>
  173. <p>&nbsp;</p>
  174. <p><a href="https://fk.wwkejishe.top/buy/23" target="_blank" style="font-weight: 900;color: #409eff;">
  175. 购买月卡:不限次数、不限制文件大小、不限速</a></p>
  176. <p>
  177. <p>&nbsp;</p>
  178. <figure class='table-figure'>
  179. <table class="layui-table" style="border-collapse: separate;">
  180. <thead>
  181. <tr>
  182. <th style="background-color: #f8f8f8; border-bottom: 2px solid #e6e6e6; padding: 10px;">百度VIP</th>
  183. <th style="background-color: #f8f8f8; border-bottom: 2px solid #e6e6e6; padding: 10px;">百度SVIP</th>
  184. <th style="background-color: #f8f8f8; border-bottom: 2px solid #e6e6e6; padding: 10px;">
  185. <a href='https://fk.wwkejishe.top/buy/23' target='_blank' style='color: #007bff; text-decoration: none;'>Pandownload月卡</a>
  186. </th>
  187. </tr>
  188. </thead>
  189. <tbody>
  190. <tr>
  191. <td style="padding: 10px; border-bottom: 1px solid #e6e6e6;">¥25/月</td>
  192. <td style="padding: 10px; border-bottom: 1px solid #e6e6e6;">¥40/月</td>
  193. <td style="padding: 10px; border-bottom: 1px solid #e6e6e6;color: rgba(5,150,105,1)">¥9/月</td>
  194. </tr>
  195. <tr>
  196. <td style="padding: 10px; border-bottom: 1px solid #e6e6e6;">20G/月</td>
  197. <td style="padding: 10px; border-bottom: 1px solid #e6e6e6;">不限制</td>
  198. <td style="padding: 10px; border-bottom: 1px solid #e6e6e6;color: rgba(5,150,105,1)">不限制文件大小、不限制文件数量、高速下载</td>
  199. </tr>
  200. </tbody>
  201. </table>
  202. </figure>
  203. <p>&nbsp;</p>
  204. <p>
  205. <a href="http://vip.jiufei.com/lin/GI5LG4?refer=1661" target="_blank" style="color: #007bff; text-decoration: none;">点击购买(高质量)网盘会员</a>:¥3/4天,¥7.5/25天,¥22.8/年
  206. </p>
  207. <p>&nbsp;</p>
  208. <p>2023-2024 © Github By <a style="color:#007bff;" href="https://github.com/dongyubin/Baidu-VIP" target="_blank">@dongyubin</a></p>
  209. </div>
  210. <div class="layui-tab-item" style="background-color: #fff; border-radius: 8px; padding: 20px;text-align: center;">
  211. <div>
  212. <img src="https://cdn.wwkejishe.top/wp-cdn-02/2024/202411171346351.webp" style="width:240px;height:240px;">
  213. </div>
  214. <h2 class="h2" style="margin-top: 10px;">扫一扫,不失联</h2>
  215. <h3 class="h2" style="margin-top: 10px;">众所周知,脚本不可能每时每刻都能用。关注不迷路 ~</h3>
  216. </div>
  217. </div>
  218. </div>
  219. `,
  220. success: function () {
  221. // 对弹层中的表单进行初始化渲染
  222. form.render();
  223. // 表单提交事件
  224. form.on('submit(demo-send)', async function (data) {
  225. $('#parseBtn').html('<p>正在发送中,请稍后...</p>');
  226. let testDown = await testSendToGopeed();
  227. if (!testDown) {
  228. layer.close(openInfoLayer);
  229. gospeedDownload();
  230. $('#parseBtn').html('<p>发送到Gopeed</p>');
  231. return;
  232. }
  233. let one_url = wwConfig.mainUrl + '/wp/getCodeNum';
  234. share_one_baidu(openInfoLayer, one_url, wwConfig.one_parse.code, wwConfig.one_parse.version);
  235. });
  236.  
  237. $('#parseWxBtn').on('click', async function () {
  238. let captchaStr = $('#captcha').val();
  239. if (captchaStr) {
  240. $('#parseWxBtn').html('<p>正在发送中,请稍后...</p>');
  241. let testDown = await testSendToGopeed();
  242. if (!testDown) {
  243. layer.close(openInfoLayer);
  244. gospeedDownload();
  245. $('#parseWxBtn').html('<p>发送到Gopeed</p>');
  246. return;
  247. }
  248. let one_url = wwConfig.mainUrl + '/wp/getPcCodeNum';
  249. share_one_baidu(openInfoLayer, one_url, captchaStr, wwConfig.wx_parse.version);
  250. } else {
  251. layer.msg('请输入验证码');
  252. }
  253.  
  254. });
  255.  
  256. // 复制 User-Agent 按钮的事件处理
  257. $('#copyUaBtn').on('click', function () {
  258. copy_text(wwConfig.ua, 'User-Agent');
  259. });
  260. },
  261. });
  262. });
  263. });
  264.  
  265. function gospeedDownload() {
  266. swal({
  267. title: "下载 Gopeed 加速器",
  268. text: '请先安装 Gopeed 并打开运行(点击按钮下载 Gopeed)。',
  269. icon: 'warning',
  270. type: "warning",
  271. confirmButtonText: '点击下载Gopeed',
  272. confirmButtonColor: "#dd6b55",
  273. }).then(function () {
  274. window.open('https://pan.quark.cn/s/0b2e9c6e94b0');
  275. });
  276. }
  277.  
  278. function selectList() {
  279. var select = {};
  280. var option = [];
  281.  
  282. try {
  283. option =
  284. require('system-core:context/context.js').instanceForSystem.list.getSelected();
  285. } catch (e) {
  286. option = document.querySelector('.wp-s-core-pan').__vue__.selectedList;
  287. }
  288. option.forEach((element) => {
  289. select[element.fs_id] = element;
  290. });
  291. return select;
  292. }
  293.  
  294. function init_parse(code) {
  295. switch (code) {
  296. case 1:
  297. layer.msg('解析中', {
  298. icon: 6,
  299. time: 3000,
  300. });
  301. setTimeout(() => {
  302. $('#parseBtn').html('<p>发送到Gopeed</p>');
  303. $('#parseWxBtn').html('<p>发送到Gopeed</p>');
  304. layer.alert('解析通道比较拥堵,请尝试快速下载!', {
  305. title: '提示',
  306. closeBtn: 0,
  307. btn: ['确定', '前往快速下载'],
  308. btn1: function (index) {
  309. $('#parseWxBtn').html('<p>发送到Gopeed</p>');
  310. layer.close(index);
  311. },
  312. btn2: function (index) {
  313. window.open('https://fk.wwkejishe.top/buy/23');
  314. }
  315. });
  316. }, 3000);
  317. break;
  318. case 2:
  319. layer.alert(
  320. '验证码错误,一个验证码只能下载一个文件,请重新获取!',
  321. {
  322. title: '提示',
  323. closeBtn: 0
  324. }, function (index) {
  325. $('#parseWxBtn').html('<p>发送到Gopeed</p>');
  326. layer.close(index);
  327. }
  328. );
  329. break;
  330. case 3:
  331. layer.alert('今日下载次数已达上线,请明天再来下载,或者使用快速下载!', {
  332. title: '提示',
  333. closeBtn: 0,
  334. btn: ['确定', '前往快速下载'],
  335. btn1: function (index) {
  336. $('#parseWxBtn').html('<p>发送到Gopeed</p>');
  337. layer.close(index);
  338. },
  339. btn2: function (index) {
  340. window.open('https://fk.wwkejishe.top/buy/23');
  341. }
  342. })
  343. default:
  344. wwConfig.one_parse.version = 1;
  345. break;
  346. }
  347.  
  348. }
  349. function share_one_baidu(openInfoLayer, url, code, version) {
  350. let select = Object.keys(selectList());
  351. let bdstoken = '';
  352. let data_json = {};
  353. try {
  354. data_json = $('html')
  355. .html()
  356. .match(/(?<=locals\.mset\()(.*?)(?=\);)/)[0];
  357. data_json = JSON.parse(data_json);
  358. wwConfig.username = data_json.username;
  359. bdstoken = data_json.bdstoken;
  360. } catch (e) {
  361. data_json = $('html')
  362. .html()
  363. .match(/(?<=window\.locals\s=\s)(.*?)(?=;)/)[0];
  364. data_json = JSON.parse(data_json);
  365. wwConfig.username = data_json.userInfo.username;
  366. bdstoken = data_json.userInfo.bdstoken;
  367. }
  368.  
  369. wwConfig.data_json = data_json;
  370.  
  371. $.ajax({
  372. type: 'GET',
  373. url: 'https://pan.baidu.com/share/set',
  374. async: true,
  375. data: {
  376. bdstoken: bdstoken,
  377. period: 1,
  378. pwd: wwConfig.bdPassword,
  379. eflag_disable: true,
  380. channel_list: '%5B%5D',
  381. schannel: 4,
  382. fid_list: JSON.stringify(select),
  383. },
  384. dataType: 'json',
  385. success: function (res) {
  386. if (res.show_msg.indexOf('禁止') > -1) {
  387. swal({
  388. text: '该文件禁止分享',
  389. icon: 'error',
  390. });
  391. return false;
  392. } else {
  393. let shorturl = '';
  394. try {
  395. shorturl = res.link.split('/').pop();
  396. } catch (error) {
  397. swal({
  398. text: '初始化准备失败',
  399. icon: 'error',
  400. });
  401. return false;
  402. }
  403. fetch(url, {
  404. method: 'POST',
  405. headers: {
  406. 'Content-Type': 'application/json',
  407. },
  408. body: JSON.stringify({
  409. code: code,
  410. userKey: 'main',
  411. fsId: select[0],
  412. version: version,
  413. }),
  414. })
  415. .then((resp) => resp.json())
  416. .then((res) => {
  417. let laysermsg = layer.msg('正在解析中', {
  418. icon: 6,
  419. time: 10000,
  420. });
  421. if (res.code == 200) {
  422. wwConfig.code = code;
  423. if (res.data > 100 || res.data.data > 100) {
  424. get_down_list(
  425. shorturl,
  426. wwConfig.bdPassword,
  427. openInfoLayer,
  428. res.data,
  429. laysermsg
  430. );
  431. }
  432. else if (res.data == 80 || res.data.data == 80) {
  433. init_parse(1);
  434. }
  435. else if (res.data == 60 || res.data.data == 60) {
  436. init_parse(1);
  437. }
  438. else if (res.data == 50 || res.data.data == 50) {
  439. init_parse(2);
  440. }
  441. else if (res.data.data == 100 || res.data.vip == 0) {
  442. init_parse(3);
  443. }
  444. else {
  445. init_parse(2);
  446. }
  447. } else if (res.code == 500) {
  448. layer.close(openInfoLayer);
  449. layer.close(laysermsg);
  450. swal({
  451. text: res.msg,
  452. icon: 'warning',
  453. });
  454. }
  455. });
  456. }
  457. },
  458. error: function (res) {
  459. swal({
  460. text: '初始化准备请求访问失败',
  461. icon: 'error',
  462. });
  463. },
  464. });
  465. }
  466.  
  467. function copy_text(text, msg) {
  468. navigator.clipboard.writeText(text).then(() => {
  469. layer.msg(msg + ' 已复制到剪贴板');
  470. }).catch(err => {
  471. layer.msg('复制失败,请手动复制:' + text);
  472. });
  473. }
  474.  
  475. async function get_down_list(shorturl, password, openInfoLayer, pwd, laysermsg) {
  476. let ajax_data = {
  477. shorturl: shorturl,
  478. pwd: password,
  479. dir: 1,
  480. root: 1,
  481. userKey: 'main',
  482. };
  483.  
  484. fetch(wwConfig.mainUrl + '/wp/parseCopyLink', {
  485. method: 'POST',
  486. headers: {
  487. 'Content-Type': 'application/json',
  488. },
  489. body: JSON.stringify(ajax_data),
  490. })
  491. .then((resp) => resp.json())
  492. .then((res) => {
  493. if (res.code == 200) {
  494. const size = parseInt(res.data.data.list[0].size);
  495. if (size > 3221225472) {
  496. layer.close(openInfoLayer);
  497. layer.close(laysermsg);
  498. $('#parseBtn').html('<p>发送到Gopeed</p>');
  499. swal({
  500. text: '文件大于 3G,插件暂不支持下载,请前往 PC 网页版下载!',
  501. icon: 'warning',
  502. });
  503. return false;
  504. }
  505. const requestData = {
  506. fsId: res.data.data.list[0].fs_id,
  507. shareid: res.data.data.shareid,
  508. uk: res.data.data.uk,
  509. sekey: res.data.data.seckey,
  510. randsk: res.data.data.seckey,
  511. fs_ids: [res.data.data.list[0].fs_id],
  512. path: res.data.data.list[0].server_filename,
  513. size: res.data.data.list[0].size,
  514. surl: shorturl,
  515. url: `https://pan.baidu.com/s/${shorturl}`,
  516. userKey: 'main',
  517. pwd: password,
  518. dir: '/',
  519. };
  520. console.log(requestData);
  521. GM_xmlhttpRequest({
  522. method: 'POST',
  523. url: wwConfig.mainUrl + '/wp/dlink',
  524. headers: {
  525. 'Content-Type': 'application/json',
  526. },
  527. data: JSON.stringify(requestData),
  528. onload: function (response) {
  529. const responseData = JSON.parse(response.responseText);
  530. console.log(responseData);
  531. if (responseData.code !== 200) {
  532. layer.close(openInfoLayer);
  533. layer.close(laysermsg);
  534. swal({
  535. text: responseData.msg,
  536. icon: 'warning',
  537. });
  538. } else {
  539. layer.close(laysermsg);
  540. $('#parseBtn').html('<p>发送到Gopeed</p>');
  541. if (responseData.data.vip) {
  542. wwConfig.url = responseData.data.data[0].url;
  543. wwConfig.ua = responseData.data.data[0].ua;
  544. } else {
  545. wwConfig.url = responseData.data.data.urls[0].url;
  546. }
  547. sendToGopeed(res.data.data.list[0]);
  548. }
  549. },
  550. onerror: function (response) {
  551. layer.close(openInfoLayer);
  552. layer.close(laysermsg);
  553. const errorMessage =
  554. JSON.parse(response.responseText).message || '网络错误';
  555. swal({
  556. text: '发送到Gopeed遇到问题了,请刷新重试即可!!',
  557. icon: 'warning',
  558. });
  559. },
  560. });
  561. } else {
  562. layer.close(openInfoLayer);
  563. layer.close(laysermsg);
  564. $('#parseBtn').html('<p>发送到Gopeed</p>');
  565. $('#parseWxBtn').html('<p>发送到Gopeed</p>');
  566. swal({
  567. text: '发送到Gopeed遇到问题了,请升级插件刷新重试即可!!',
  568. icon: 'warning',
  569. });
  570. }
  571. });
  572. }
  573. function testSendToGopeed() {
  574. return fetch(wwConfig.goPeedTaskUrl, {
  575. method: 'POST',
  576. headers: {
  577. 'Content-Type': 'application/json'
  578. },
  579. })
  580. .then((resp) => resp.json())
  581. .then((res) => {
  582. return true;
  583. }).catch(e => {
  584. return false;
  585. })
  586. }
  587. function sendToGopeed(item) {
  588. fetch(wwConfig.goPeedTaskUrl, {
  589. method: 'POST',
  590. headers: {
  591. 'Content-Type': 'application/json'
  592. },
  593. body: JSON.stringify({
  594. req:
  595. {
  596. url: wwConfig.url,
  597. extra: {
  598. header: {
  599. "User-Agent": wwConfig.ua,
  600. }
  601. }
  602. },
  603. opt: {
  604. extra: {
  605. connections: 256,
  606. }
  607. }
  608. }),
  609. }).then((resp) => resp.json())
  610. .then((res) => {
  611. layer.confirm(`请打开 Gopeed 查看 <span style="color:rgba(5,150,105,1);">${item.server_filename}</span> 是否开始下载?未下载成功,先设置IDM/NDM User-Agent:<code>` + wwConfig.ua + `</code>,再复制直链下载!`, {
  612. btn: ['已下载,关闭弹窗', '未下载,复制直链']
  613. }, function (index) {
  614. layer.close(index);
  615. }, function () {
  616. GM_setClipboard(wwConfig.url, "text");
  617. layer.msg(`${item.server_filename} 的直链复制成功!`);
  618. });
  619. }).catch(e => {
  620. })
  621. }
  622. setInterval(() => {
  623. GM_xmlhttpRequest({
  624. method: 'get',
  625. url: wwConfig.goPeedTaskUrl + '?status=running',
  626. headers: {
  627. 'Content-Type': 'application/json',
  628. },
  629. onload: function (response) {
  630. const responseData = JSON.parse(response.responseText);
  631. const result = responseData.data.filter(e =>
  632. e.status === "running"
  633. ).filter((e) => e.progress.speed < 1048576).map(e => e.id);
  634. const ids = result.map((e) => {
  635. return `id=${e}`
  636. }).join('&')
  637. if (ids && ids.length) {
  638. GM_xmlhttpRequest({
  639. method: 'put',
  640. url: `${wwConfig.goPeedTaskUrl}/pause?${ids}`,
  641. headers: {
  642. 'Content-Type': 'application/json',
  643. },
  644. onload: function (response) {
  645. GM_xmlhttpRequest({
  646. method: 'put',
  647. url: `${wwConfig.goPeedTaskUrl}/continue?${ids}`,
  648. headers: {
  649. 'Content-Type': 'application/json',
  650. },
  651. onload: function (response) {
  652. }
  653. })
  654. }
  655. })
  656. }
  657. }
  658. })
  659. }, 15000)
  660.  
  661. })();