百度网盘SVIP解析高速下载-度娘加速

百度网盘SVIP解析高速下载,24小时维护100%可以用!使用IDM下载更加稳定IDM UA设置:LogStatistic Chrome浏览器一定打开开发者模式才能正常显示出来!

Устаревшая версия за 20.03.2025. Перейдите к последней версии.

  1. // ==UserScript==
  2. // @name 百度网盘SVIP解析高速下载-度娘加速
  3. // @namespace momoz
  4. // @version 2.3
  5. // @author momo
  6. // @description 百度网盘SVIP解析高速下载,24小时维护100%可以用!使用IDM下载更加稳定IDM UA设置:LogStatistic Chrome浏览器一定打开开发者模式才能正常显示出来!
  7. // @antifeature ads
  8. // @antifeature tracking
  9. // @antifeature membership
  10. // @license MIT
  11. // @icon https://nd-static.bdstatic.com/m-static/v20-main/home/img/icon-home-new.b4083345.png
  12. // @match *://pan.baidu.com/*
  13. // @match *://yun.baidu.com/*
  14. // @match *://pan.baidu.com/disk/home*
  15. // @match *://yun.baidu.com/disk/home*
  16. // @match *://pan.baidu.com/disk/main*
  17. // @match *://yun.baidu.com/disk/main*
  18. // @match *://pan.baidu.com/s/*
  19. // @match *://yun.baidu.com/s/*
  20. // @match *://pan.baidu.com/share/*
  21. // @match *://yun.baidu.com/share/*
  22. // @match http://127.0.0.1:5500/*
  23. // @connect baidu.com
  24. // @connect 127.0.0.1
  25. // @connect ty.shzxkq.com
  26. // @grant GM_addStyle
  27. // @grant GM_getResourceText
  28. // @run-at document-idle
  29. // @require https://lib.baomitu.com/layui/2.9.3/layui.min.js
  30. // ==/UserScript==
  31.  
  32.  
  33.  
  34. (function () {
  35.  
  36. addStylesheet('https://lib.baomitu.com/layui/2.9.3/css/layui.css');
  37.  
  38.  
  39.  
  40. var config = {
  41. gonggao: "每8小时8次200G大文件解析,40次1.5G左右小文件解析,小文件解析等待时间1到19分钟左右!IDM UA设置:LogStatistic",
  42. host_list: {
  43. "1": "https://bdb.shzxkq.com",
  44. "2": "https://ty.shzxkq.com",
  45. "3": ""
  46. },
  47. bd_password: "asdf",
  48. title_name: "度娘加速",
  49. file_name:"",
  50. savePath: 'D:\\',
  51. jsonrpc: 'http://localhost:6800/jsonrpc',
  52. username: "",
  53. tab_id: "1",
  54. ua: "netdisk;",
  55. window_height: 525, //界面高度
  56. workdata: {},
  57. dropdown: null,
  58. file_size:0
  59. }
  60. config.main_url = config.host_list['1'];
  61. config.main_img_url = config.host_list['1'] + '/xcx.jpg';
  62.  
  63.  
  64. function addStylesheet(url) {
  65. var link = document.createElement('link');
  66. link.rel = 'stylesheet';
  67. link.href = url;
  68. link.type = 'text/css';
  69. document.head.appendChild(link);
  70. }
  71.  
  72. function setdropdown_off_on(state = false) {
  73. let dom = document.querySelector(`#tab${config.tab_id} .demo-dropdown-on`);
  74. if (state) {
  75. dom.setAttribute("disabled", "");
  76. dom.classList.add('layui-btn-disabled');
  77. dom.classList.remove('demo-dropdown-on_ondisabled');
  78. } else {
  79. dom.removeAttribute("disabled");
  80. dom.classList.remove('layui-btn-disabled');
  81. dom.classList.add('demo-dropdown-on_ondisabled');
  82. }
  83. }
  84.  
  85.  
  86. layui.use(['layer'], async function () {
  87. var layer = layui.layer, $ = layui.$, element = layui.element;
  88. var dropdown = layui.dropdown;
  89. await Promise.resolve(new Promise((resolve) => setTimeout(resolve, 888)));
  90.  
  91. if (location.href.startsWith("https://pan.baidu.com/s/")) {
  92. //分享界面加按钮
  93. $('.x-button-box').prepend('<a class="g-button" id="downbtn_share" style="background-color: #6800ff;color: #fff;border-color: #6800ff;" href="javascript:;" ><span class="g-button-right"><em class="icon icon-download" title=""></em><span class="text" style="width: auto;">' + config.title_name + '</span></span></a>');
  94. } else {
  95. // 其他界面加按钮
  96. if ($('.tcuLAu').is('*')) {
  97. //旧版
  98. $('.tcuLAu').prepend('<span class="g-dropdown-button"><a id="downbtn_main" style=" margin-right: 10px;color: #fff;background-color: #6800ff;border-color: #6800ff;" id="downbtn_main" class="g-button" ><span class="g-button-right"><em class="icon icon-download" ></em><span class="text" style="width: auto;">' + config.title_name + '</span></span></a></span>');
  99. } else {
  100. //新版
  101. $('.wp-s-agile-tool-bar__header.is-header-tool').prepend('<div class="wp-s-agile-tool-bar__h-group"><button style=" margin-right: 10px;color: #fff;background-color: #6800ff;border-color: #6800ff;" id="downbtn_main" class="u-button nd-file-list-toolbar-action-item" ><i class="iconfont icon-download"></i> <span>' + config.title_name + '</span></button></div>');
  102. }
  103. }
  104.  
  105. $('#downbtn_share').click(function () {
  106. my_alert("提示:请先保存到自己的网盘后,从网盘里解析!");
  107. return false;
  108. });
  109.  
  110.  
  111. $('#downbtn_main').click(function () {
  112. let xuanzhe_list = get_xuanzhe_list();
  113. let xuanzhe_list2 = Object.keys(xuanzhe_list);
  114. if (xuanzhe_list2.length == 0) {
  115. my_alert("提示:请先选择一个文件");
  116. return false;
  117. } else if (xuanzhe_list2.length > 1) {
  118. my_alert("提示:目前仅支持一个文件解析");
  119. return false;
  120. } else if (xuanzhe_list[xuanzhe_list2[0]].isdir == 1) {
  121. my_alert("提示:目前不支持文件夹解析!");
  122. return false;
  123. }
  124.  
  125.  
  126. let file_info_obj = xuanzhe_list[xuanzhe_list2[0]];
  127.  
  128. config.file_size = file_info_obj.size;
  129.  
  130. let html_code = `
  131. <style>
  132. .pincode-input {width: 38px;height: 38px;line-height: 50px;border-radius: 3px;border: 2px solid gray;text-align: center;font-size: 1.5rem}
  133. .pincode-input:not(:last-child) {margin-right: 1rem}
  134. .pincode-input.pincode-input--focused {border-color: #000}
  135. .pincode-input.pincode-input--filled {border-color: dodgerblue}
  136. .layui-layer-setwin .layui-layer-close2 {position: absolute;right: -5px !important;top: -5px !important;}
  137. .layui-layer-close::before {content: "X" !important;}
  138. .swal2-container {z-index: 999999999 !important;}
  139. .swal2-popup {padding-top: 20px !important;justify-items: center !important;}
  140. .blockquote {display: inline-block;white-space: nowrap;width: 100%;overflow: hidden;text-overflow: ellipsis;}
  141. .layui-tab .layui-tab-title {border-bottom-width: 0;}
  142. .layui-tab-brief>.layui-tab-title li {color: #6a6a6a;font-weight: 700;font-size: 16px;}
  143. .layui-tab-brief>.layui-tab-title .layui-this {color: #2196f3;font-weight: 700;font-size: 16px;}
  144. .layui-tab-brief>.layui-tab-more li.layui-this:after,
  145. .layui-tab-brief>.layui-tab-title .layui-this:after {border: none;border-radius: 0;width: 50%;left: 25%;border-bottom: 5px solid #2196f3;}
  146. .layui-tab {margin: 0;}
  147. .layui-tab-title {background: #fff;}
  148. .layui-layer-page {border-radius: 25px;}
  149. .demo {display: none;margin-top: 12px;}
  150. #popup {width: 320px;height: 195px;position: absolute;right: 6px;bottom: 58px;border: 1px solid #000;background-color: #fff;display: none;}
  151. #dialogDivSavePath {text-align: left;line-height: 23px;position: absolute;padding: 15px;color: rgba(0, 0, 0, .86);}
  152. .layui-btn-sm {height: 45px;line-height: 30px;padding: 0 15px;font-size: 14px;}
  153. .piao {background-image: linear-gradient(90deg, rgb(114, 9, 212), rgb(40, 50, 212) 33%, rgb(0, 165, 178));color: rgba(0, 0, 0, 0);-webkit-background-clip: text;font-style: normal;}
  154. .layui-layer-content {overflow: hidden !important;}
  155. .h1 {font-family: PingFangSC-Regular, sans-serif, Microsoft YaHei, SimHei, Tahoma !important;font-weight: 700;margin-bottom: 16px;font-size: 32px;line-height: 48px;}
  156. .h2 {font-size: 21px;line-height: 2;}
  157. .h3 {font-size: 16.38px;line-height: 2;}
  158. .layui-card-body {position: relative;padding: 10px 15px;line-height: 22px;}
  159. .imgset {position: absolute;cursor: pointer;font-size: 9px;right: 15px;bottom: 23px;width: 35px;}
  160. .my_button_class1 {background-color: #ff436a;color: #fff;border-color: #ff436a;font-weight: 700;}
  161. #my_loadingtext {display: none;padding: 1px;background: rgb(255 255 255);position: absolute;z-index: 2147483647;text-align: center;top: 57%;font-weight: 500;color: rgb(3, 169, 244);font-size: 25px;left: 50%;transform: translate(-50%, -50%);}
  162. .swal2-container {z-index: 9999999999 !important; }
  163. .layui-layer-page {border-radius: 0px !important;}
  164.  
  165.  
  166.  
  167. .borderNo_bottom {border-top: 2px #000000 solid;border-left: 2px #000000 solid;border-right: 2px #000000 solid;}
  168. .borderNo_topANDleft {border-right: 2px #000000 solid;}
  169. .Other_layui-tab-item {border: 2px solid black;height: 550px;text-align: center;}
  170. .tab_item_content {position: relative;height: 500px;width: 800px;margin: 0 auto;display: flex;justify-content: center;align-items: center;}
  171. .layui-this {color: #000 !important;}
  172. .layui-layer-page {border-radius: 0px !important;}
  173. .layui-tab-title .layui-this::after {height: 40px !important;;}
  174. .layui-this:after {background-color: rgba(30, 24, 20, 0.45) !important;border-bottom: 0px solid red !important;width: 100% !important;left: 0px !important;}
  175. .layui-btn{background-color: #fb7d4b !important;}
  176. .layui-btn-disabled{background-color: #fbfbfb !important;}
  177. .layui-tab-title{background-color: #fff;border: 2px solid black;}
  178. .my_tab_br{border-right:2px solid black;}
  179.  
  180. .demo-dropdown-on{height: 45px;font-size: 18px;color: #fff;}
  181. .demo-dropdown-on_ondisabled {background-color: #16baaa !important;}
  182.  
  183.  
  184. </style>`;
  185.  
  186. function tab_html(tabid) {
  187. config.workdata[String(tabid)] = [];
  188. return `
  189. <div class="layui-card" style="border: 2px solid black;margin-bottom: -2px;padding:1px 25px;">
  190. <div style="text-align:center;">公告:${config.gonggao}</div>
  191. </div>
  192. <div class="layui-card" style="border: 2px solid black;margin-bottom: -2px;padding:10px 25px;">
  193. <b>
  194. <div class="server_filename" style="text-align:center;">当前文件名:</div>
  195. </b>
  196. <div style="text-align:center;">扫描二维码获取解析密码后,点击解析按钮</div>
  197. <div style="text-align:center;">
  198. <img id="code_img" src="${config.host_list[config.tab_id]}/xcx.jpg" style="width:240px;height:240px;">
  199. </div>
  200. </div>
  201.  
  202. <div class="layui-card" style="margin-bottom: -1px;border-left: 2px solid black;padding:10px 25px;border-top: 0xp solid black;border-right: 2px #000000 solid;border-bottom: 2px #000 solid;">
  203. <button type="button" class="main_start layui-btn layui-btn-sm" style="/*! float: right; */margin-left: 355px;">提交解析</button>
  204. </div>
  205.  
  206. <div style="border-left: 2px solid black;border-top: 0xp solid black;border-right: 2px #000000 solid;border-bottom: 2px #000 solid;padding: 15px 25px;">
  207. <button class="layui-btn layui-btn-primary demo-dropdown-on layui-btn-disabled" style="" id="dropdown_tab${tabid}" lay-options="{trigger: 'mousedown'}" disabled>
  208. 点击复制解析直链IDM下载
  209. <i class="layui-icon layui-icon-down layui-font-12"></i>
  210. </button>
  211. <button type="button" class="main_start_query layui-btn layui-btn-sm" style="float: right;">查询任务</button>
  212. </div>
  213. `;
  214. }
  215.  
  216. html_code += `<body>
  217. <div class="layui-tab layui-tab-card" id="tab" lay-filter="demo">
  218. <ul class="layui-tab-title" style="">
  219. <li class="layui-this my_tab_br" lay-id="1">大文件解析</li>
  220. <li class="my_tab_br" lay-id="2">2G左右小文件解析</li>
  221. <li class="my_tab_br" lay-id="3">筹建中03</li>
  222. <li class="my_tab_br" lay-id="help">联系我们</li>
  223. </ul>
  224. <div class="layui-tab-content" style="padding-top:0px">
  225. <div class="layui-tab-item layui-show" id="tab1" style="margin-top: 2px;">
  226. ${tab_html(1)}
  227. </div>
  228. <div class="layui-tab-item" id="tab2" style="margin-top: 2px;">
  229. ${tab_html(2)}
  230. </div>
  231. <div class="layui-tab-item" id="tab3" style="margin-top: 2px;">
  232. ${tab_html(3)}
  233. </div>
  234.  
  235. <div class="layui-tab-item" style="margin-top: 2px;">
  236. <div style="text-align:center;border: 2px solid black;height:${config.window_height - 20}px;position:relative;">
  237. <div style="position: absolute;top:50%;left:50%;transform:translate(-50%,-50%);">
  238. <div>TG: https://t.me/xiaomozycc</div>
  239. </div>
  240. </div>
  241.  
  242. </div>
  243.  
  244. </div>
  245. </div>
  246. </body>`;
  247. // 渲染
  248.  
  249.  
  250.  
  251. layer.open({
  252. type: 1,
  253. title: false,
  254. closeBtn: 1,
  255. shadeClose: true,
  256. // shade: 0.9, // 遮罩透明度
  257. // area: ['500px', '367px'],//宽 高
  258. area: ['500px', config.window_height + 'px'],//宽 高
  259. content: html_code,
  260. success: function (layero, index) {
  261. let data_json = {};
  262. config.tab_id = 1;
  263. config.workdata = {};
  264. config.main_url = config.host_list[config.tab_id];
  265. document.querySelector(`#tab${ config.tab_id} #code_img`).src = config.main_url + "/xcx.jpg";
  266.  
  267.  
  268. try {
  269. data_json = $("html").html().match(/(?<=locals\.mset\()(.*?)(?=\);)/)[0];
  270. data_json = JSON.parse(data_json);
  271. config.username = data_json.username;
  272. } catch (e) {
  273. data_json = $("html").html().match(/(?<=window\.locals\s=\s)(.*?)(?=;)/)[0];
  274. data_json = JSON.parse(data_json);
  275. config.username = data_json.userInfo.username;
  276. }
  277. config.data_json = data_json;
  278.  
  279. dropdown.render({
  280. elem: '.demo-dropdown-on', // 绑定元素选择器,此处指向 class 可同时绑定多个元素
  281. data: [],
  282. disabled: true,
  283. templet: function (d) {
  284. state_dict = ["layui-icon-lock","layui-icon-loading-1","layui-icon-success"];
  285. icon_class = d.workstate >= 3?"layui-icon-question":state_dict[d.workstate];
  286.  
  287. if (d.workstate == 2) {
  288. if (String(d.download_url).indexOf("http") == -1) {
  289. icon_class = "layui-icon-error";
  290. icon_color = "red";
  291. } else {
  292. icon_color = "green";
  293. }
  294. } else {
  295. icon_color = "red";
  296. }
  297.  
  298. return `<div class="layui-menu-body-title" >
  299. <p class="layadmin-textimg" style="color: ${icon_color};">
  300. <i class="layui-icon ${icon_class}" style="font-size: 20px;"></i>
  301. ${d.title}
  302. </p>
  303. </div>`;
  304. },
  305. click: function (obj) {
  306. // alert(obj.title);
  307. if (String(obj.download_url).indexOf("http") == -1) {
  308. layer.msg("排队解析中,请耐心等待1到5分钟后查询直链!!!!");
  309. return false;
  310. }
  311. var textarea = document.createElement('textarea');
  312. textarea.style.position = 'fixed';
  313. textarea.style.opacity = 0;
  314. textarea.value = obj.download_url;
  315. document.body.appendChild(textarea);
  316. textarea.select();
  317. document.execCommand('copy');
  318. document.body.removeChild(textarea);
  319. layer.msg(obj.title + '的下载直链已复制');
  320. }
  321. });
  322. config.dropdown = dropdown;
  323.  
  324. config.dropdown.reloadData(`dropdown_tab${config.tab_id}`, { 'data': set_dropdown_data() })
  325.  
  326. // 监听Tab切换
  327. element.on('tab(demo)', function (data) {
  328. var $this = $(this);
  329. console.log($this, data)
  330. // 获取当前激活的Tab的lay-id属性值
  331. var tabId = data.elem.context.attributes['lay-id'].value;
  332. config.tab_id = tabId;
  333. config.dropdown.reloadData(`dropdown_tab${config.tab_id}`, { 'data': set_dropdown_data() })
  334. if (tabId === 'help') {
  335. // $this.text('重新加载的内容:help');
  336. console.log(config)
  337. } else {
  338. config.main_url = config.host_list[tabId];
  339. document.querySelector(`#tab${tabId} #code_img`).src = config.main_url + "/xcx.jpg";
  340. }
  341.  
  342. });
  343.  
  344. $(".my_setting").click(function () {
  345. //作废
  346. // alert("设置")
  347. let promptI = layer.prompt({ title: '输入下载路径', formType: 0, value: config.savePath }, function (value, index) {
  348. layer.close(promptI);
  349. config.savePath = value;
  350. layer.msg("下载路径设置完成:" + config.savePath);
  351. });
  352. })
  353. config.file_name = file_info_obj.server_filename;
  354. $(".server_filename").text("当前文件名:" + file_info_obj.server_filename);
  355.  
  356. $('.main_start_query').click(function () {
  357. get_all_down_url();
  358. })
  359.  
  360.  
  361. $('.main_start').click(function () {
  362. // $('.copy').addClass('layui-btn-disabled').removeAttr('down-url');
  363. // $('.pusharia').addClass('layui-btn-disabled').removeAttr('down-url');
  364. if (get_parse_key_value(config.tab_id) && get_parse_key_time(config.tab_id) && new Date().getTime() < Number(get_parse_key_time(config.tab_id))) {
  365. layer.load(2, {
  366. shade: [0.3, '#FFF'],
  367. });
  368. share_one_baidu();
  369. } else {
  370. let promptI = layer.prompt({ title: '密码已重置,请重新输入', formType: 1 }, function (value, index) {
  371. layer.close(promptI);
  372. //layer.msg("密码输入完成");
  373.  
  374. set_parse_key(config.tab_id, value)
  375. layer.load(2, { shade: [0.3, '#FFF'], });
  376. share_one_baidu();
  377. });
  378. }
  379.  
  380. });
  381. $('.copy').click(function () {
  382. //作废
  383. if (!$(this).hasClass('layui-btn-disabled')) {
  384. var textarea = document.createElement('textarea');
  385. textarea.style.position = 'fixed';
  386. textarea.style.opacity = 0;
  387. textarea.value = $(this).attr('down-url');
  388. document.body.appendChild(textarea);
  389. textarea.select();
  390. document.execCommand('copy');
  391. document.body.removeChild(textarea);
  392. layer.msg('链接复制成功');
  393. }
  394. });
  395.  
  396. $('.pusharia').click(function () {
  397. //作废
  398. if (!$(this).hasClass('layui-btn-disabled')) {
  399. var url = $(this).attr('down-url');
  400.  
  401. sendAria2(url, $('.server_filename').text().replace("当前文件名:", ""));
  402. // sendAria2(url, file_info_obj.server_filename);
  403. layer.msg('推送成功');
  404. }
  405. });
  406. },
  407. });
  408. });
  409.  
  410.  
  411. });
  412.  
  413. function set_parse_key(tabid, value) {
  414. // localStorage.my_password = value;
  415. // localStorage.my_password_end = get_endTime();
  416. localStorage['my_password_' + tabid] = value;
  417. localStorage['my_password_' + tabid + "_end"] = get_endTime();
  418. }
  419. function get_parse_key_value(tabid) {
  420. return localStorage['my_password_' + tabid];
  421. }
  422. function get_parse_key_time(tabid) {
  423. return localStorage['my_password_' + tabid + "_end"];
  424. }
  425. function set_dropdown_data() {
  426. dropdown_temp_data = config["workdata"][config.tab_id];
  427. dropdown_data = [];
  428. for (let o in dropdown_temp_data) {
  429. dropdown_data.push({
  430. title: dropdown_temp_data[o].filename,
  431. download_url: dropdown_temp_data[o].download_url,
  432. workid: dropdown_temp_data[o].workid,
  433. file_id: dropdown_temp_data[o].file_id,
  434. download_endtime: dropdown_temp_data[o].download_endtime,
  435. workstate: dropdown_temp_data[o].workstate,
  436. download_endtime_timestamp: dropdown_temp_data[o].download_endtime_timestamp,
  437. })
  438. }
  439.  
  440. console.log(dropdown_data);
  441. return dropdown_data;
  442. }
  443.  
  444.  
  445.  
  446.  
  447. function formatBytes(a, b = 2) {
  448. if (0 === a) return "0 Bytes";
  449. const c = 0 > b ? 0 : b,
  450. d = Math.floor(Math.log(a) / Math.log(1024));
  451. return parseFloat((a / Math.pow(1024, d)).toFixed(c)) + " " + ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"][d]
  452. }
  453. function formatDate(time, format = 'YY-MM-DD hh:mm:ss') {
  454. if (time == undefined) return "--";
  455. time = Number(time + "000");
  456. var date = new Date(time);
  457.  
  458. var year = date.getFullYear(),
  459. month = date.getMonth() + 1,
  460. day = date.getDate(),
  461. hour = date.getHours(),
  462. min = date.getMinutes(),
  463. sec = date.getSeconds();
  464. var preArr = Array.apply(null, Array(10)).map(function (elem, index) {
  465. return '0' + index;
  466. });
  467.  
  468. var newTime = format.replace(/YY/g, year)
  469. .replace(/MM/g, preArr[month] || month)
  470. .replace(/DD/g, preArr[day] || day)
  471. .replace(/hh/g, preArr[hour] || hour)
  472. .replace(/mm/g, preArr[min] || min)
  473. .replace(/ss/g, preArr[sec] || sec);
  474.  
  475. return newTime;
  476. }
  477. function get_endTime() {
  478. var date = new Date();
  479. var year = date.getFullYear();
  480. var month = date.getMonth() + 1;
  481. var day = date.getDate();
  482. var hours = date.getHours();
  483. var on_30min = Number(new Date(year + "-" + month + "-" + day + " " + hours + ":30:00"));
  484. if (new Date().getTime() < on_30min) {
  485. result_time = on_30min;
  486. } else {
  487. result_time = on_30min + 30 * 60 * 1000;
  488. }
  489. return result_time;
  490. }
  491.  
  492. function my_alert(text_value = "") {
  493. layui.layer.open({
  494. type: 1,
  495. title: false,
  496. closeBtn: 1,
  497. shadeClose: true,
  498. skin: 'yourclass',
  499. content: `
  500. <div style="border: 2px solid black;padding:30px 80px;word-wrap:break-word;">
  501. ${text_value}
  502. </div>`
  503.  
  504. });
  505. }
  506.  
  507. function sendAria2(url, out_filename, ua) {
  508. //作废
  509. var Aria2_config = {
  510. "jsonrpc": "2.0",
  511. "method": "aria2.addUri",
  512. "id": 1,
  513. "params": [
  514. [url],
  515. {
  516. "header": [`User-Agent: ${config.ua}`],
  517. "out": out_filename,
  518. "dir": config.savePath,
  519. "pause": "false",//是否暂停下载
  520. "max-connection-per-server": "15",
  521. "seed-ratio": "0",
  522. "continue": 'true',
  523. "user-agent": "LogStatistic"
  524. }]
  525. }
  526. $.ajax({
  527. url: config.jsonrpc,
  528. data: JSON.stringify(Aria2_config),
  529. type: "post",
  530. //async: false,//false为同步
  531. dataType: "json",
  532. success: function (obj) {
  533. console.log(obj)
  534. }
  535. });
  536. }
  537.  
  538. function get_xuanzhe_list() {
  539. // return {
  540. // "1051603260599775": {
  541. // isdir: 0
  542. // }
  543. // }
  544. var xuanzhe_list = {};
  545. var xuanxiang = [];
  546.  
  547. try {
  548. xuanxiang = require('system-core:context/context.js').instanceForSystem.list.getSelected();
  549. } catch (e) {
  550. xuanxiang = document.querySelector('.wp-s-core-pan').__vue__.selectedList;
  551. }
  552. xuanxiang.forEach(element => {
  553. xuanzhe_list[element.fs_id] = element;
  554. });
  555. return xuanzhe_list;
  556. }
  557.  
  558.  
  559. function share_one_baidu() {
  560. let xuanzhe_list = Object.keys(get_xuanzhe_list());
  561. let bdstoken = "";
  562. let data_json = {};
  563. try {
  564. data_json = $("html").html().match(/(?<=locals\.mset\()(.*?)(?=\);)/)[0];
  565. data_json = JSON.parse(data_json);
  566. config.username = data_json.username;
  567. bdstoken = data_json.bdstoken;
  568. } catch (e) {
  569. data_json = $("html").html().match(/(?<=window\.locals\s=\s)(.*?)(?=;)/)[0];
  570. data_json = JSON.parse(data_json);
  571. config.username = data_json.userInfo.username;
  572. bdstoken = data_json.userInfo.bdstoken;
  573. }
  574. config.data_json = data_json;
  575. $.ajax({
  576. type: 'GET',
  577. url: "https://pan.baidu.com/share/set",
  578. async: true,
  579. data: {
  580. bdstoken: bdstoken,
  581. period: 1,
  582. pwd: config.bd_password,
  583. eflag_disable: true,
  584. channel_list: "%5B%5D",
  585. schannel: 4,
  586. fid_list: JSON.stringify(xuanzhe_list)
  587. },
  588. dataType: 'json',
  589. success: function (res) {
  590. console.log(res)
  591. if (res.show_msg.indexOf("禁止") > -1) {
  592. layer.closeAll('loading');
  593. my_alert("该文件禁止分享");
  594. return false;
  595. } else {
  596. let shorturl = "";
  597. try {
  598. shorturl = res.link.split("/").pop();
  599. } catch (error) {
  600. layer.closeAll('loading');
  601. my_alert("错误:初始化准备失败!");
  602. return false;
  603. }
  604. get_down_list(shorturl, config.bd_password);
  605. layer.closeAll('loading');
  606. }
  607.  
  608. },
  609. error: function (res) {
  610. my_alert("错误:初始化准备请求访问失败");
  611. layer.closeAll('loading');
  612. },
  613. })
  614.  
  615. }
  616.  
  617.  
  618. function get_down_url() {
  619. //作废
  620. server_filename_dom = document.querySelector(`#tab${config.tab_id} .server_filename`);
  621. t_parsekey = server_filename_dom.getAttribute("parsekey");
  622. t_workid = server_filename_dom.getAttribute("workid");
  623. let down_url = `${config.main_url}/querywork.php?workid=${t_workid}&parsekey=${t_parsekey}&username=${config.username}`;
  624. $.ajax({
  625. url: down_url,
  626. method: 'GET',
  627. error: function (params) {
  628. console.error(2, params);
  629. my_alert("请重新解析尝试");
  630. layer.closeAll('loading');
  631. },
  632. success: function (json) {
  633. // json = JSON.parse(params);
  634. console.log(3, json);
  635. if (json.code == 0 && json.workstate == 2) {
  636. // ddd = json.data;
  637. // console.log("待下载文件详情", ddd);
  638.  
  639. // Size = formatBytes(ddd.filesize);
  640. // Time = formatDate(ddd.filectime, 'YY/MM/DD hh:mm:ss');
  641. config.ua = json.ua;
  642. let downlink = json.download_url;
  643. if (downlink.indexOf("http") >= 0) {
  644.  
  645. server_filename_dom = document.querySelector(`#tab${config.tab_id} .server_filename`)
  646. for (let i of ['filename', 'workstate', "workid", "shorturl", "password", "parsekey", "creattime"]) { server_filename_dom.removeAttribute(i) }
  647.  
  648. layer.closeAll('loading');
  649. my_alert("成功:解析成功");
  650.  
  651.  
  652.  
  653. $('.copy').removeClass('layui-btn-disabled').attr('down-url', downlink);
  654. $('.pusharia').removeClass('layui-btn-disabled').attr('down-url', downlink);
  655. } else {
  656. layer.closeAll('loading');
  657. my_alert("错误:下载链接解析异常【" + json.msg + "】");
  658. }
  659.  
  660.  
  661. } else {
  662. my_alert(json.msg + ",状态: " + json.workstate_msg);
  663. layer.closeAll('loading');
  664. return false;
  665. }
  666. }
  667.  
  668. });
  669.  
  670. }
  671. function get_all_down_url() {
  672. config["workdata"][config.tab_id] = [];
  673. config.dropdown.reloadData(`dropdown_tab${config.tab_id}`, { 'data': set_dropdown_data() })
  674. setdropdown_off_on(true);
  675.  
  676. server_filename_dom = document.querySelector(`#tab${config.tab_id} .server_filename`);
  677. t_parsekey = server_filename_dom.getAttribute("parsekey");
  678. t_workid = server_filename_dom.getAttribute("workid");
  679. let down_url = `${config.main_url}/querywork_all.php?username=${config.username}`;
  680. config["workdata"][config.tab_id] = [];
  681. $.ajax({
  682. url: down_url,
  683. method: 'GET',
  684. error: function (params) {
  685. console.error(2, params);
  686. my_alert("请尝试重新查询");
  687. layer.closeAll('loading');
  688. },
  689. success: function (json) {
  690. // json = JSON.parse(params);
  691. console.log(3, json);
  692. if (json.code == 0) {
  693. data_list = json.data;
  694. config.ua = json.ua;
  695. config["workdata"][config.tab_id] = [];
  696. jiexi_ok_count = 0;
  697.  
  698. for (let obj of data_list) {
  699. console.log(obj)
  700. config["workdata"][config.tab_id].push(obj);
  701. if (obj.code == 0 && obj.workstate == 2) {
  702. downlink = obj.download_url;
  703. if (downlink.indexOf("http") >= 0) {
  704. jiexi_ok_count++;
  705. // config["workdata"][config.tab_id].push(obj);
  706. } else {
  707. // my_alert("错误:下载链接解析异常【" + json.msg + "】");
  708. }
  709.  
  710. }
  711. }
  712. layer.closeAll('loading');
  713. setdropdown_off_on(false);
  714. console.log("eeeee",config.tab_id,config["workdata"][config.tab_id])
  715. config.dropdown.reloadData(`dropdown_tab${config.tab_id}`, { 'data': set_dropdown_data() })
  716. my_alert("查询成功:已解析成功任务 " + jiexi_ok_count + " 个");
  717.  
  718.  
  719. } else {
  720. my_alert("失败:" + json.msg);
  721. layer.closeAll('loading');
  722. return false;
  723. }
  724.  
  725. },
  726. });
  727.  
  728. }
  729. function get_down_list(shorturl, password) {
  730. let parse_key = get_parse_key_value(config.tab_id)
  731. let xuanzhe_list = Object.keys(get_xuanzhe_list());
  732. //let filename_text = document.querySelector(".server_filename").textContent;
  733. let filename_text = config.file_name;
  734. let url = `${config.main_url}/addwork.php`;
  735. $.ajax({
  736. type: 'POST',
  737. url: url,
  738. async: true,
  739. data: {
  740. "filename":encodeURIComponent(filename_text),
  741. "username":config.username,
  742. "baidu_fileid":xuanzhe_list[0],
  743. "size":config.file_size,
  744. "shorturl":shorturl,
  745. "password":password,
  746. "parsekey":parse_key,
  747. },
  748. dataType: 'json',
  749. success: function (res) {
  750. console.log(res)
  751. if (res.code == 0 || res.code == 13) {
  752.  
  753. req_data = res.data;
  754. console.log(2, req_data);
  755. server_filename_dom = document.querySelector(`#tab${config.tab_id} .server_filename`);
  756. for (let i in req_data) {
  757. if (i in ['filename', 'workstate']) {
  758. continue;
  759. }
  760. server_filename_dom.setAttribute(i, req_data[i])
  761. }
  762. t = {
  763. 0: "任务创建完成",
  764. 13: "任务已存在请勿重复提交"
  765. }
  766. my_alert(`成功:${t[res.code]},任务id为:` + req_data["workid"]);
  767.  
  768. } else {
  769.  
  770. if (res.code == 104) {
  771. //重置密码
  772. set_parse_key(config.tab_id, "")
  773. layer.closeAll('loading');
  774. my_alert("密码错误(可能密码超出有效期),请重新提交");
  775. return false;
  776. } else {
  777. my_alert("失败:" + res.msg);
  778. layer.closeAll('loading');
  779. return false;
  780. }
  781. }
  782. },
  783. error: function (res) {
  784. my_alert("错误:初始解析请求访问失败,重新提交");
  785. layer.closeAll('loading');
  786. },
  787. });
  788.  
  789. }
  790. })()