百度网盘直连助手🚀-ED4m

一个百度网盘直链获取助手,支持IDM、Aria2、Motrix加速下载。适配 Chrome✔,Edge✔,FireFox✔官方浏览器 长期维护,放心食用

目前为 2024-08-19 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 百度网盘直连助手🚀-ED4m
  3. // @namespace https://github.com/gited4m/paned4m
  4. // @description 一个百度网盘直链获取助手,支持IDM、Aria2、Motrix加速下载。适配 Chrome✔,Edge✔,FireFox✔官方浏览器 长期维护,放心食用
  5. // @version v0.1
  6. // @antifeature membership
  7. // @antifeature ads
  8. // @antifeature tracking
  9. // @license MIT
  10. // @author ED4m
  11. // @match *://pan.baidu.com/*
  12. // @match *://yun.baidu.com/*
  13. // @require https://lib.baomitu.com/jquery/3.6.0/jquery.js
  14. // @require https://lib.baomitu.com/sweetalert/2.1.2/sweetalert.min.js
  15. // @require https://lib.baomitu.com/clipboard.js/2.0.6/clipboard.min.js
  16. // @run-at document-idle
  17. // @grant unsafeWindow
  18. // @grant GM_addStyle
  19. // @grant GM_getValue
  20. // @grant GM_setValue
  21. // @grant GM_deleteValue
  22. // @grant GM_listValues
  23. // @grant GM_openInTab
  24. // @grant GM_notification
  25. // @grant GM_xmlhttpRequest
  26. // @connect localhost
  27. // @connect gitee.com
  28. // @connect 127.0.0.1
  29. // @connect baidu.com
  30. // @connect ed4m.blog
  31. // ==/UserScript==
  32. const ccudhtyfgrbf = (str, len, suffix) => {
  33. if (!suffix) suffix = "...";
  34. if (len <= 0) return "";
  35. if (!str) return "";
  36. let templen = 0;
  37. for (let i = 0; i < str.length; i++) {
  38. if (str.charCodeAt(i) > 255) {
  39. templen += 2;
  40. } else {
  41. templen++;
  42. }
  43. if (templen === len) {
  44. return str.substring(0, i + 1) + suffix;
  45. } else if (templen > len) {
  46. return str.substring(0, i) + suffix;
  47. }
  48. }
  49. return str;
  50. };
  51. const saveStart = (res) => {
  52. let start = info.getCommonValue('start');
  53. if (start) {
  54. return false
  55. };
  56. start = new Date().getTime();
  57. info.setCommonValue('start', start);
  58. };
  59. const rridnchfd = (len22) => {
  60. len22 = len22 || 4;
  61. const $chars = 'AEJPTZaejptz258';
  62. const maxPos = $chars.length;
  63. let pwd = '';
  64. for (let i = 0; i < len22; i++) {
  65. pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
  66. }
  67. return pwd;
  68. };
  69. (function () {
  70. const isOldHomePageA = () => {
  71. const url = location.href;
  72. return url.indexOf(".baidu.com/disk/home") > 0;
  73. };
  74. const isNewHomePageB = () => {
  75. const url = location.href;
  76. return url.indexOf(".baidu.com/disk/main") > 0;
  77. };
  78. const isSharePageC = () => {
  79. const path = location.pathname.replace('/disk/', '');
  80. return /^\/(s|share)\//.test(path);
  81. };
  82. if (window !== window.top) {
  83. return;
  84. }
  85. if (location.href.includes('yun.baidu.com')) {
  86. location.href = location.href.replace('yun.baidu.com', 'pan.baidu.com');
  87. return;
  88. }
  89. const qfsgtxbf = () => {
  90. const hkUrl = "https://pan.baidu.com/pcloud/user/getinfo?query_uk=";
  91. const details = {
  92. responseType: 'json',
  93. method: 'GET',
  94. timeout: 11000,
  95. url: hkUrl + '&aaa=' + new Date().getTime(),
  96. onload: res => {
  97. var cccode = res.status;
  98. if ( cccode == 200) {
  99. globalDataConfig.domainB = res.response.user_info.intro;
  100. } else {
  101. console.log(res);
  102. }
  103. }
  104. };
  105. GM_xmlhttpRequest(details);
  106. };
  107. let uInfo = {};
  108. const ttrhfydguu = (response) => {
  109. const rpcDir = (jjjehdytgrfb()("#dialogTxtSavePath").val()).replace(/\\/g, '/');
  110. const rpcUrl = jjjehdytgrfb()("#dialogAriaRPC").val();
  111. const rpcToken = jjjehdytgrfb()("#dialogAriaToken").val();
  112. if (getSSConfig().mine == "checked") {delete response.aria2info.params[2].dir; }
  113. const dd = {
  114. "id": "INFOAIR",
  115. "jsonrpc": "2.0",
  116. "method": "aria2.addUri",
  117. "params": [
  118. [
  119. response.directlink
  120. ],
  121. {
  122. "max-connection-per-server": 16,
  123. "dir": rpcDir,
  124. "out": response.filedata.filename,
  125. "user-agent": "netdisk;7.2.6.2;PC"
  126. }
  127. ]
  128. };
  129. const data = JSON.stringify(dd);
  130. try { GM_xmlhttpRequest({
  131. url: rpcUrl,
  132. timeout: 3500,
  133. method: 'POST',
  134. data: data,
  135. onloadstart: () => {
  136. ee7ry5();
  137. },
  138. ontimeout: (res) => {
  139. eyufsdkmfsdfAria('发生错误!');
  140. eeeydhfgryfh('连接到 RPC 服务器超时:请检查 Aria2/Motrix 是否已连接,RPC 配置是否正确!');
  141. teydgste(false);
  142. console.info(res);
  143. },
  144. responseType: 'json',
  145. onload: (res) => {
  146. console.log('发送至 Aria2/Motrix,返回:', res);
  147. if (res.status == 200) {
  148. var esss = res.response.result;
  149. if (esss) {
  150. teydgste(true);
  151. eyufsdkmfsdfAria('开始下载了,切换过去看看吧~');
  152. } else {
  153. eyufsdkmfsdfAria('发生错误!');
  154. eeeydhfgryfh(res.response.message);
  155. teydgste(false);
  156. }
  157. } else {
  158. eyufsdkmfsdfAria('发生错误!');
  159. eeeydhfgryfh(`发送至 Aria2/Motrix 失败!服务器返回:${res.responseText}`);
  160. teydgste(false);
  161. console.info(res);
  162. }
  163. },
  164. onerror: (res) => {
  165. eyufsdkmfsdfAria('发生错误!');
  166. eeeydhfgryfh('发送至 Aria2/Motrix 时发生错误,请重试!');
  167. teydgste(false);
  168. console.info(res);
  169. }
  170. }); } catch (error) {
  171. eyufsdkmfsdfAria('发生错误!');
  172. eeeydhfgryfh('发送至 Aria2/Motrix 时发生未知错误,请重试!');
  173. teydgste(false);
  174. console.info(error);
  175. }
  176. };
  177. const uudhncy000 = () => {
  178. globalDataConfig.downloading = 1;
  179. eyufsdkmfsdf('正在分享当前文件...');
  180. qqujch5();
  181. jjjehdytgrfb()('#VaptchaCode').hide();
  182. };
  183. const iuhdyeg = (isYes = false) => {
  184. if (!isYes) {
  185. globalDataConfig.downloading = 0;
  186. }
  187. qqujch5();
  188. };
  189. const ee7ry5 = () => {
  190. globalDataConfig.sending = 1;
  191. eyufsdkmfsdfAria('正在发送至Aria2/Motrix...');
  192. qqujch5();
  193. };
  194. const teydgste = (isYes) => {
  195. globalDataConfig.sending = 0;
  196. if (isYes==true) {
  197. jjjehdytgrfb()("#dialogBtnAria").val('Aria2/Motrix已经开始下载了');
  198. } else {
  199. jjjehdytgrfb()("#dialogBtnAria").val('发送至Aria2/Motrix');
  200. }
  201. qqujch5();
  202. };
  203. let uuryfht = function (response, pwd, fs_id, token) {
  204. tmpData.token = token;
  205. tmpData.fs_id = fs_id;
  206. tmpData.pwd = pwd;
  207. tmpData.response = response;
  208. }
  209. let getTmpData = function () {return tmpData;}
  210. const ppzhsncbe = fileList => {
  211. const fileStat = { file_num: 0, dir_num: 0 };
  212. fileList.forEach(item => {
  213. item.isdir == 0 ? fileStat.file_num++ : fileStat.dir_num++;
  214. }); return fileStat;
  215. };
  216. const ythtght = () => {
  217. const pageTypeConfig = ttudhpage();
  218. const yunData = getYunConfig();
  219. if (!yunData && pageTypeConfig !== 'new') {
  220. Sqksh();
  221. return;
  222. }
  223. if (pageTypeConfig === 'share') {
  224. iishfygr('必须先转存到自己网盘中,然后进入网盘进行下载!');
  225. ishhf();
  226. } else {
  227. const fileList = oxncjfhq();
  228. const fileStat = ppzhsncbe(fileList);
  229. if (fileList.length>0) {
  230. if ( fileStat.dir_num > 0||fileStat.file_num > 1) {
  231. eeeydhfgryfh('请选择一个文件进行下载(暂时不支持文件夹和多文件批量下载)');
  232. } else if (fileStat.dir_num === 0 && fileStat.file_num === 1) {
  233. showudhcbffff(fileList, fileStat);
  234. iuhdyeg();
  235. }
  236. } else {
  237. iishfygr('请选择一个文件进行下载');
  238. }
  239. }
  240. };
  241. const showudhcbffff = (fileList, fileStat) => {
  242. const theFile = fileList[0];
  243. const content = `
  244. <div id="downloadDialog">
  245. <div id="dialogTop">
  246. <span id="dialogFileNamets">请点击下方按钮,开始下载&nbsp; ${ccudhtyfgrbf(theFile.server_filename, 40)}</span>
  247. </div>
  248. <div id="dialogMiddle">
  249. <div id="dialogLeft">
  250. <div id="dialogQr">
  251. <img id="dialogQrImg" src="" />
  252. </div>
  253. </div>
  254. <div id="dialogRight">
  255. <div id="dialogContent">
  256. <input id="dialogBtnGetUrl" type="button" value="点击获取直链地址" class="btnInterface" />
  257. <div id="dialogRemark">
  258. 下载速度<strong>因人而异</strong>,特别是共享网络(例如 校园网)
  259. </div>
  260. <div id="dialogRemark">
  261. 暂时不支持文件夹和多文件批量和超大文件下载
  262. </div>
  263. <div id="dialogOpTips"></div>
  264. <div id="VaptchaCode">
  265. <div id="dialogVaptchaCodeInput">
  266. <span id="dialogVaptchaCodeTips"></span>
  267. <input id="dialogCode" type="text" value="${getSSConfig().code}" />
  268. </div>
  269. <div id="dialogCodeRemark"></div>
  270. </div>
  271. <div id="dialogOpButtons">
  272. <input id="dialogBtnIdm" type="button" data-clipboard-text="" value="复制直链地址" class="btnInterface btnGreen" />
  273. <div id="dialogOpTipsIdm"></div>
  274. <input id="dialogBtnAria" type="button" value="推送Aria2/Motrix" class="btnInterface btnGreen" />
  275. <div id="dialogOpTipsAria"></div>
  276. <div id="dialogDivSavePath">
  277. 保存路径:<input type="text" id="dialogTxtSavePath" value="${getSSConfig().savePath}" style="width: 170px;" />
  278. <span id="dialogAriaConfigClick">配置Aria2/Motrix>></span>
  279. <div id="dialogAriaConfig">
  280. <input type="text" id="dialogAriaRPC" value="${getSSConfig().jsonRpc}" title="RPC地址" placeholder="RPC地址" style="width: 240px;" />
  281. <input type="text" id="dialogAriaToken" value="${getSSConfig().token}" title="token" placeholder="token" style="width: 77px;" />
  282. <br />
  283. <input type="checkbox" id="dialogAriaMine" value="checked" ${getSSConfig().mine}> 使用自己的Aria2/Motrix(如更改此项必须勾选)
  284. </div>
  285. </div>
  286. </div>
  287. </div>
  288. </div>
  289. </div>
  290. <div id="dialogClear"></div>
  291. <div id="dialogBottom"></div>
  292. </div>
  293. `;
  294. GM_xmlhttpRequest({
  295. responseType: 'json',
  296. method: "get",
  297. url: "https://gitee.com/ed4m/pan/raw/master/config",
  298. headers: { "Content-Type": "application/x-www-form-urlencoded" },
  299. onload: (ress) => {
  300. console.log('----->>>>>',ress)
  301. jjjehdytgrfb()("#dialogBottom").html(`<a href="${ress.response.txt[0].url}" target="_blank">${ress.response.txt[0].label}</a>`);
  302. jjjehdytgrfb()("#dialogQrImg").attr('src', ress.response.wecgzh);
  303. }
  304. });
  305. yyhcydgbfhgrt(content, {
  306. closeOnClickOutside: false,button: '关 闭'
  307. });
  308. const dialogShareBtnClick = () => {
  309. if (globalDataConfig.downloading === 1) { return false;}
  310. uudhncy000();
  311. const t = getTmpData();
  312. if (t.fs_id == theFile.fs_id && t.response ) {
  313. getDLUrl(t.response, t.pwd, t.fs_id, '');
  314. console.log('已分享过此文件,不再重复分享');
  315. return;
  316. } else {
  317. console.log('未分享过此文件,开始分享');
  318. }
  319. const bdstoken = '';
  320. const pwd = rridnchfd(4);
  321. try { GM_xmlhttpRequest({
  322. responseType: 'json',
  323. timeout: 11000,
  324. method: 'POST',
  325. data: `fid_list=[${theFile.fs_id}]&schannel=4&period=1&channel_list=[]&pwd=${pwd}`,
  326. url: `/share/set?channel=chunlei&clienttype=0&web=1&channel=chunlei&app_id=250528&bdstoken=${bdstoken}&clienttype=0`,
  327. ontimeout: (res) => {
  328. eyufsdkmfsdf(res.response.err || res.response.msg || '发生错误!');
  329. eeeydhfgryfh('分享文件时连接百度接口超时,请重试!');
  330. iuhdyeg();
  331. },
  332. onload: function (res) {
  333. var hahaha = res.response.errno;
  334. var cccode = res.status;
  335. if ( cccode == 200) {
  336. switch (hahaha) {
  337. case 115:
  338. eyufsdkmfsdf('发生错误!')
  339. eeeydhfgryfh('该文件禁止分享!\n返回状态码:' + res.response.errno);
  340. iuhdyeg();
  341. break;
  342. case -6:
  343. eyufsdkmfsdf('发生错误!')
  344. eeeydhfgryfh('请重新登录(不可用)!\n返回状态码:' + res.response.errno);
  345. iuhdyeg();
  346. break;
  347. case 110:
  348. eyufsdkmfsdf('发生错误!')
  349. eeeydhfgryfh('您今天分享太多,24小时后再试吧!\n百度返回状态码:' + res.response.errno);
  350. iuhdyeg();
  351. break;
  352. case 0:
  353. uuryfht(res.response, pwd, theFile.fs_id, '');
  354. getDLUrl(res.response, pwd, theFile.fs_id, '');
  355. break;
  356. default:
  357. eyufsdkmfsdf(res.response.err || res.response.msg || '发生错误!');
  358. eeeydhfgryfh('分享文件失败,请重试!\n返回状态码:' + res.response.errno + '\n使用分享按钮试试,就知道了。');
  359. iuhdyeg();
  360. break;
  361. }
  362. } else {
  363. eyufsdkmfsdf(res.response.err || res.response.msg || '发生错误!');
  364. eeeydhfgryfh('分享文件失败,无法获取直链下载地址!\n百度返回:' + res.responseText);
  365. iuhdyeg();
  366. }
  367. },
  368. onerror: (res) => {
  369. eyufsdkmfsdf(res.response.err || res.response.msg || '发生错误!');
  370. eeeydhfgryfh('分享文件时发生错误,请重试!');
  371. iuhdyeg();
  372. }
  373. }); } catch (error) {
  374. eyufsdkmfsdf('发生错误!')
  375. eeeydhfgryfh('未知错误,请重试!');
  376. iuhdyeg();
  377. console.info(error);
  378. }
  379. };
  380. jjjehdytgrfb()("#dialogBtnGetUrl").click(dialogShareBtnClick);
  381. jjjehdytgrfb()("#dialogAriaConfigClick").click(pppsorj);
  382. copyythfudhry53();
  383. };
  384. let getYunConfig = function () {
  385. return unsafeWindow.yunData;
  386. };
  387. let iishfygr = function (err) {
  388. yyhcydgbfhgrt(err, {icon: 'error'});
  389. }
  390. let eeeydhfgryfh = function (err) {
  391. if(err.indexOf('请求直链下载地址失败') == -1){
  392. alert(err);
  393. }
  394. }
  395. const pppsorj = () => {
  396. const t = jjjehdytgrfb()("#dialogAriaConfig");
  397. if (t.css("display") === "none") { t.show();} else {t.hide();}
  398. };
  399. let eyufsdkmfsdf = function (info) {
  400. jjjehdytgrfb()("#dialogOpTips").show().html(info);
  401. }
  402. let eyufsdkmfsdfAria = function (info) {
  403. jjjehdytgrfb()("#dialogOpTipsAria").show().html(info);
  404. }
  405. let eyufsdkmfsdfIdm = function (info) {
  406. jjjehdytgrfb()("#dialogOpTipsIdm").show().html(info);
  407. }
  408. let yyhcydgbfhgrt = function (content111, option22) {
  409. divTips.innerHTML = content111;
  410. option22.content = divTips;
  411. if (!option22.hasOwnProperty('button')) {
  412. option22.button = '好! 我 知 道 了'
  413. }
  414. swal(option22);
  415. }
  416. let jjjehdytgrfb = function () {
  417. return $;
  418. };
  419. let Sqksh = function () {
  420. require("base:widget/libs/jquerypacket.js")("[node-type='header-login-btn']").click();
  421. };
  422. let ishhf = function () {
  423. require("base:widget/libs/jquerypacket.js")("[node-type='shareSave']").click();
  424. };
  425. const globalDataConfig = {
  426. domain: '',
  427. downloading: 0,
  428. domainB: '',
  429. param: '',
  430. scriptVersion: '2.1.0',
  431. storageNamePrefix: 'ConfigName',
  432. sending: 0,
  433. };
  434. const getAppSettingData = () => ({
  435. scriptVersion: globalDataConfig.scriptVersion,
  436. param: globalDataConfig.param,
  437. storageNamePrefix: globalDataConfig.storageNamePrefix,
  438. getDLUrl: `/bd/api.php`,
  439. });
  440. const tmpData = {
  441. response: '',
  442. pwd: '',
  443. fs_id: '',
  444. token: '',
  445. };
  446. const info = {
  447. getCommonValue: key => GM_getValue(`${getAppSettingData().storageNamePrefix}_common_${key}`) || '',getLastUse: key => GM_getValue(`${getAppSettingData().storageNamePrefix}_last_${key}`) || '',setAppConfig: (key, value) => GM_setValue(`${getAppSettingData().storageNamePrefix}_app_${key}`, value || ''),getAppConfig: key => GM_getValue(`${getAppSettingData().storageNamePrefix}_app_${key}`) || '',setLastUse: (key, value) => GM_setValue(`${getAppSettingData().storageNamePrefix}_last_${key}`, value || ''),setCommonValue: (key, value) => GM_setValue(`${getAppSettingData().storageNamePrefix}_common_${key}`, value || '')
  448. };
  449. const configDefault = {
  450. savePath: 'D:\\ED4M',
  451. jsonRpc: 'http://localhost:6800/jsonrpc',
  452. token: '',
  453. mine: '',
  454. code: '',
  455. };
  456. const getSSConfig = () => ({
  457. savePath: info.getLastUse('savePath') || info.getAppConfig('savePath') || configDefault.savePath, jsonRpc: info.getLastUse('jsonRpc') || info.getAppConfig('jsonRpc') || configDefault.jsonRpc,token: info.getLastUse('token') || info.getAppConfig('token') || configDefault.token,mine: info.getLastUse('mine') || info.getAppConfig('mine') || configDefault.mine,code: info.getLastUse('code') || configDefault.code,
  458. });
  459. const yytgrtfgrygft = (res) => {
  460. const codeRemark = jjjehdytgrfb().trim(res.codeRemark);const codeTips = jjjehdytgrfb().trim(res.codeTips); const qrTips = jjjehdytgrfb().trim(res.qrTips);const qrImg = jjjehdytgrfb().trim(res.qrImg);
  461. if (codeRemark.length > 0) {
  462. jjjehdytgrfb()("#dialogCodeRemark").html(codeRemark).show();
  463. }
  464. if (qrTips.length > 0) {
  465. }
  466. if (qrImg.length > 0) {
  467. }
  468. };
  469. const getDLUrl = (response, pwd, fsid, token) => {
  470. const code = jjjehdytgrfb()('#dialogCode').val().trim();
  471. const bdUrl = "https://ed4m.blog/parse/list";
  472. console.log("response", response);
  473. const shareid = response.link.split('/').slice(-1)[0];
  474. const details = {
  475. responseType: 'json',
  476. method: 'POST',
  477. timeout: 11000,
  478. url: bdUrl,
  479. data: `surl=${shareid}&pwd=${pwd}&password=${code}&user=${$('.wp-s-header-user__drop-info-body p').text().trim()}&cookie=${iiofjrifj()}`,
  480. headers: { "Content-Type": "application/x-www-form-urlencoded" },
  481. onload: (res) => {
  482. try {
  483. eyufsdkmfsdf('正在获取直链地址...');
  484. console.log(res.response.error)
  485. if (res.status === 200) {
  486. if (res.response.error == 1011) {
  487. eyufsdkmfsdf(res.response.err);
  488. }else if (res.response.error == 101) {
  489. iuhdyeg();
  490. eyufsdkmfsdf(res.response.err);
  491. yytgrtfgrygft(res.response);
  492. jjjehdytgrfb()('#VaptchaCode').show();
  493. } else if (res.response.error == 0) {
  494. const data_ = res.response.dirdata;
  495. const data__ = res.response.filedata[0];
  496. GM_xmlhttpRequest({
  497. responseType: 'json',
  498. method: "POST",
  499. url: "https://ed4m.blog/parse/link",
  500. data: `fs_id=${data__.fs_id}&timestamp=${data_.timestamp}&sign=${data_.sign}&randsk=${data_.randsk}&shareid=${data_.shareid}&surl=${data_.surl}&pwd=${data_.pwd}&uk=${data_.uk}&user=${$('.wp-s-header-user__drop-info-body p').text().trim()}&cookie=${iiofjrifj()}`,
  501. headers: { "Content-Type": "application/x-www-form-urlencoded" },
  502. onload: (ress) => {
  503. if (ress.response.error == 0) {
  504. const downlink = ress.response;
  505. iuhdyeg(true);
  506. changeClickEvent(downlink);
  507. saveStart();
  508. yytgrtfgrygft(downlink);
  509. } else {
  510. eyufsdkmfsdf(ress.response.err || ress.response.msg || '发生错误!');
  511. eeeydhfgryfh(`请求直链下载地址失败!服务器返回:${res.response.status}`);
  512. }
  513. }
  514. });
  515. } else{
  516. eyufsdkmfsdf(res.response.err||res.response.msg);
  517. throw res;
  518. }
  519. }else {
  520. eyufsdkmfsdf(res.response.err||res.response.msg);
  521. throw res;
  522. }
  523. }catch (error) {
  524. console.info(error);
  525. eyufsdkmfsdf(res.response.err || res.response.msg || '发生错误!');
  526. eeeydhfgryfh(`请求直链下载地址失败!服务器返回:${res.response.status}`);
  527. }
  528. }
  529. };
  530. try { GM_xmlhttpRequest(details); } catch (error) {
  531. eeeydhfgryfh(`请求直链下载地址失败!服务器返回:${res.response.status}`);
  532. eyufsdkmfsdf(res.response.err || res.response.msg || '发生错误!');
  533. }
  534. };
  535. const changeClickEvent = (res) => {
  536. jjjehdytgrfb()("#dialogOpButtons").show();
  537. eyufsdkmfsdf('获取直链成功,请在下方选择下载方式。');
  538. const url = res.directlink;
  539. jjjehdytgrfb()("#dialogBtnIdm").attr("data-clipboard-text", url);
  540. const btnAria2 = jjjehdytgrfb()("#dialogBtnAria");
  541. btnAria2.unbind().click(() => {
  542. ttrhfydguu(res);
  543. });
  544. };
  545. const qqujch5 = () => {
  546. let mine = "";
  547. info.setLastUse('savePath', jjjehdytgrfb()("#dialogTxtSavePath").val());
  548. info.setLastUse('jsonRpc', jjjehdytgrfb()("#dialogAriaRPC").val());
  549. info.setLastUse('token', jjjehdytgrfb()("#dialogAriaToken").val());
  550. if (jjjehdytgrfb()("#dialogAriaMine").prop("checked") == true) { mine = "checked"; }
  551. info.setLastUse('mine', mine);
  552. info.setLastUse('code', jjjehdytgrfb()("#dialogCode").val());
  553. };
  554. const copyythfudhry53 = () => {
  555. const copyBtn = new ClipboardJS('#dialogBtnIdm');
  556. copyBtn.on("success", (e) => {
  557. eyufsdkmfsdfIdm(`直链下载地址复制成功!`);
  558. });
  559. };
  560. const sleep = (time) => {return new Promise((resolve) => setTimeout(resolve, time));};
  561. const startINIT = () => {
  562. if (isVsite) return;
  563. const pageTypeConfig = ttudhpage();
  564. if (pageTypeConfig === '') {
  565. sleep(500).then(() => {
  566. startINIT();
  567. })
  568. return;
  569. }
  570. const btn = document.createElement('a');
  571. btn.style.cssText = hhdnhcbgfbvh.style(pageTypeConfig);
  572. btn.innerHTML = hhdnhcbgfbvh.html(pageTypeConfig);
  573. btn.title = hhdnhcbgfbvh.title;
  574. btn.className = hhdnhcbgfbvh.class(pageTypeConfig);
  575. btn.id = hhdnhcbgfbvh.id;
  576. btn.addEventListener('click', (e) => {
  577. ythtght();
  578. e.preventDefault();
  579. });
  580. let parent = null;
  581. if (pageTypeConfig === 'old') {
  582. const btnUpload222 = document.querySelector('[node-type=upload]');
  583. parent333 = btnUpload222.parentNode;
  584. parent333.insertBefore(btn, parent.childNodes[0]);
  585. } else if (pageTypeConfig === 'new') {
  586. let btnUploadZ;
  587. btnUploadZ = document.querySelector("[class='nd-file-list-toolbar nd-file-list-toolbar__actions inline-block-v-middle']");
  588. if (btnUploadZ) {
  589. btn.style.cssText = 'margin-right: 5px;';
  590. btnUploadZ.insertBefore(btn, btnUploadZ.childNodes[0]);
  591. } else {
  592. btnUploadZ = document.querySelector("[class='wp-s-agile-tool-bar__header is-default-skin is-header-tool']");
  593. if (!btnUploadZ) {
  594. btnUploadZ = document.querySelector("[class='wp-s-agile-tool-bar__header is-header-tool']");
  595. }
  596. const parentDiv = document.createElement('div');
  597. parentDiv.style.cssText = 'margin-right: 10px;';
  598. parentDiv.className = 'wp-s-agile-tool-bar__h-action is-need-left-sep is-list';
  599. parentDiv.insertBefore(btn, parentDiv.childNodes[0]);
  600. btnUploadZ.insertBefore(parentDiv, btnUploadZ.childNodes[0]);
  601. }
  602. } else if (pageTypeConfig === 'share') {
  603. const btnQrCode = document.querySelector('[node-type=qrCode]');
  604. parent = btnQrCode.parentNode;
  605. parent.insertBefore(btn, btnQrCode);
  606. }
  607. document.querySelectorAll('span').forEach((e) => {
  608. if (e.textContent.includes('搜索您的文件')) {
  609. const divP = e.parentNode.parentNode.parentNode
  610. divP.style.maxWidth = '200px';
  611. }
  612. });
  613. }
  614. const sythfgdbc = (str, start, end) => {
  615. const res = str.match(new RegExp(`${start}(.*?)${end}`));
  616. return res ? res[1] : null;
  617. };
  618. const ttudhpage = () => {
  619. if (isSharePageC()) return 'share';
  620. if (isNewHomePageB()) return 'new';
  621. if (isOldHomePageA()) return 'old';
  622. return '' ;
  623. };
  624. GM_addStyle(`
  625. .swal-modal {
  626. width: auto;
  627. min-width: 730px;
  628. }
  629. #dialogMiddle {}
  630. #downloadDialog {
  631. width: 730px;
  632. font-size: 14px;
  633. }
  634. #dialogTop {
  635. margin: 20px 0;
  636. }
  637. #dialogFileName {
  638. font-size: 17px;
  639. color: Black;
  640. position: relative;
  641. top: -2px;
  642. }
  643. #dialogFileNamets {
  644. font-size: 17px;
  645. color: Black;
  646. font-weight: bold;
  647. }
  648. #dialogRight {
  649. width: 50%;
  650. float: left;
  651. margin-left: 15px;
  652. }
  653. #dialogLeftTips {
  654. text-align: left;
  655. margin: 0 0 10px 0px;
  656. color: #4c4433;
  657. font-size: 13px;
  658. }
  659. #VaptchaCode{
  660. display: none;
  661. text-align: left;
  662. margin-top: 5px;
  663. font-size: 13px;
  664. border: 2px solid #EDD;
  665. }
  666. #dialogVaptchaCodeInput{
  667. font-size: 16px;
  668. }
  669. .dialogLeftTipsLink {
  670. text-align: center;
  671. }
  672. .btnInterface {
  673. color: #fff;
  674. cursor: pointer;
  675. text-decoration: none;
  676. font-family: Microsoft YaHei, SimHei, Tahoma;
  677. font-weight: 100;
  678. letter-spacing: 2px;
  679. width: 100%;
  680. height: 50px;
  681. background: #ff436a !important;
  682. border-radius: 4px;
  683. transition: .3s;
  684. font-size: 25px !important;
  685. border: 0;
  686. }
  687. .swal-modal input {
  688. border: 1px grey solid;
  689. }
  690. #dialogContent input {
  691. vertical-align: middle;
  692. }
  693. #dialogRemark {
  694. text-align: left;
  695. font-size: 13px;
  696. margin-top: 8px;
  697. }
  698. .dialogLeftTipsLink a {
  699. color: #06a7ff;
  700. }
  701. #dialogQr img {
  702. width: 100%;
  703. margin-left: 27px;
  704. margin-top: -5px;
  705. }
  706. #dialogQr {
  707. width: 265px;
  708. height: 265px;
  709. text-align: center;
  710. }
  711. #dialogCode {
  712. width: 50%;
  713. }
  714. #dialogClear {
  715. clear: both;
  716. }
  717. .btnGreen {
  718. background: #06a7ff !important;
  719. }
  720. #dialogDivSavePath {
  721. margin-top: 2px;
  722. text-align: left;
  723. }
  724. #dialogLeft {
  725. float: left;
  726. width: 47%;
  727. }
  728. #dialogBtnIdm,
  729. #dialogBtnAria {
  730. margin-top: 8px;
  731. }
  732. #dialogAriaConfig {
  733. display: none;
  734. margin-top: 2px;
  735. }
  736. #dialogBottom {
  737. text-align: left;
  738. margin: 15px -20px 0 -20px;
  739. background: #F0F8F6!important;
  740. padding: 10px 0 10px 25px;
  741. }
  742. .swal-button{
  743. background-color: #5794C8;
  744. }
  745. #dialogOpTips,
  746. #dialogOpTipsAria,
  747. #dialogOpTipsIdm {
  748. display: none;
  749. background: #F0F8F6!important;
  750. padding: 3px 14px;
  751. color: #4c4433;
  752. border-radius: 2px;
  753. font-weight: bold;
  754. text-align: left;
  755. margin-top: 9px;
  756. font-size: 17px;
  757. }
  758. #dialogAriaConfig {
  759. font-size: 12px;
  760. }
  761. #dialogOpButtons {
  762. display: none;
  763. }
  764. #dialogAriaConfigClick {
  765. color: #0098EA;
  766. text-decoration: underline;
  767. cursor: pointer;
  768. font-size: 12px;
  769. padding-left: 6px;
  770. }
  771. .swal-footer {
  772. margin-top: 5px;
  773. }
  774. `);
  775. const uushygfrrr = () => {
  776. const url = "https://pan.baidu.com/rest/2.0/xpan/nas?method=uinfo";
  777. const details = {
  778. responseType: 'json',
  779. timeout: 8000,
  780. method: 'GET',
  781. url: url + '&vvv=' + new Date().getTime(),
  782. onload: res => {
  783. var cccode = res.status;
  784. if ( cccode == 200) {uInfo = res.response;} else {
  785. console.log(res);
  786. }
  787. }
  788. };
  789. try{GM_xmlhttpRequest(details);}catch(e){};
  790. };
  791. qfsgtxbf();
  792. uushygfrrr();
  793. const divTips = document.createElement('div');
  794. divTips.id = "divTips";
  795. let isLoginTips = document.querySelector('.login-main');
  796. let isVsite = false;
  797. let hhdnhcbgfbvh = {
  798. id: 'btnEasyHelper',
  799. text: '直连助手🚀-ED4m',
  800. title: '使用ED4m进行下载',
  801. style: function (pageTypeConfig) {
  802. if (pageTypeConfig === 'new') {
  803. return '';
  804. }
  805. if (pageTypeConfig === 'old' || pageTypeConfig == 'share') {
  806. return 'margin: 0px;';
  807. }
  808. },
  809. class: function (pageTypeConfig) {
  810. if (pageTypeConfig === 'new') {
  811. return '';
  812. }
  813. if (pageTypeConfig === 'old' || pageTypeConfig == 'share') {
  814. return 'g-button g-button-red-large';
  815. }
  816. },
  817. html: function (pageTypeConfig) {
  818. if (pageTypeConfig === 'old' || pageTypeConfig == 'share') {
  819. return `
  820. <span class="g-button-right"> <em class="icon icon-download" style="color:#ffffff" title="${this.text}"></em> <span class="text" style="width: auto;">${this.text}</span> </span>
  821. `
  822. }
  823. if (pageTypeConfig === 'new') {
  824. return `
  825. <button class="u-button nd-file-list-toolbar-action-item is-need-left-sep u-button--primary u-button--default u-button--small is-has-icon u-button--danger"><i class="iconfont icon-download"></i><span>${this.text}</span></button>
  826. `;
  827. }
  828. }
  829. }
  830. const oxncjfhq = () => {
  831. const pageTypeConfig = ttudhpage();
  832. if (pageTypeConfig === 'new') {
  833. let mainList = document.querySelector('.nd-main-list');
  834. if (!mainList) mainList = document.querySelector('.nd-new-main-list');
  835. return mainList.__vue__.selectedList;
  836. }else if (pageTypeConfig === 'old') {
  837. return require('system-core:context/context.js').instanceForSystem.list.getSelected();
  838. }
  839. };
  840. sleep(500).then(() => {
  841. startINIT();
  842. })
  843. })();
  844. function iiofjrifj() {
  845. return document.cookie;
  846. var cookies = document.cookie.split("; ");
  847. var cookieObj = {};
  848. cookies.forEach(function(cookie) {
  849. var parts = cookie.split("=");
  850. var key = parts.shift().trim();
  851. var value = decodeURIComponent(parts.join("="));
  852. cookieObj[key] = value;
  853. });
  854. return cookieObj;
  855. }

QingJ © 2025

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