// ==UserScript== // @name 百度网盘不限制下载-神速Down // @namespace https://github.com/AFANOOO/sspan // @version 6.6 // @author GreasyFork // @description 不限制速度下载的百度网盘解析脚本,无视黑号,拥有IDM/Aria2/Motrix三种方式任意体验极速下载!支持Microsoft Edge、Google Chrome、Firefox等浏览器 面向所有网友免费交流学习使用,更多功能正在完善中... // @license AGPL-3.0-or-later // @icon https://vitejs.dev/logo.svg // @match *://pan.baidu.com/* // @match *://yun.baidu.com/* // @match *://pan.baidu.com/disk/home* // @match *://yun.baidu.com/disk/home* // @match *://pan.baidu.com/disk/main* // @match *://yun.baidu.com/disk/main* // @match *://pan.baidu.com/s/* // @match *://yun.baidu.com/s/* // @match *://pan.baidu.com/share/* // @match *://yun.baidu.com/share/* // @connect localhost // @connect 127.0.0.1 // @connect baidu.com // @connect sswpdd.xyz // @require https://lib.baomitu.com/layui/2.9.3/layui.min.js // @require https://lib.baomitu.com/limonte-sweetalert2/11.10.2/sweetalert2.all.min.js // @require https://lib.baomitu.com/layui/2.9.3/layui.js // @resource customCSS https://lib.baomitu.com/layui/2.9.3/css/layui.css // @grant GM_xmlhttpRequest // @grant GM_addStyle // @grant GM_getResourceText // @run-at document-idle // ==/UserScript== var siteUrl = 'https://sswpdd.xyz'; $(function () { function wait(ms) { return Promise.resolve(new Promise((resolve) => setTimeout(resolve, ms))); } var closeimg = 'https://s11.ax1x.com/2024/01/04/pivYEjg.png'; const css = GM_getResourceText("customCSS"); GM_addStyle(css); if (!localStorage['jsonrpc']) { localStorage['jsonrpc'] = 'http://localhost:6800/jsonrpc'; } $('head').append(` `); var UA; var password = '6688'; // var requestTimeouts = 20000; // var timeoutId = setTimeout(function () { // Swal.fire({ // title: '系统提示', // text: '初始化脚本失败,可能后台无法通讯,也有可能正在被攻击。建议查看公告或者群消息获取最新信息。', // icon: 'error' // }); // }, requestTimeouts); let configDefault = { savePath: localStorage['savePath'] || 'D:\\SSDOWN', jsonRpc: localStorage['jsonRpc'] || 'http://localhost:6800/jsonrpc', token: localStorage['token'] || '', mine: localStorage['mine'] || '', code: '', }; // Usage layui.use(['layer', 'element'], async function () { var layer = layui.layer; var element = layui.element; if (location.href.match(/^https:\/\/pan\.baidu\.com\/s\/[^\s]*$/)) { //prepend是在最前面添加,加在后面用append $('.x-button-box').eq(0).prepend('神速Down'); } else if (location.href.startsWith('https://pan.baidu.com/disk/home')) { console.log(location.href, 22222222, $('.tcuLAu')); await wait(1000); $('.tcuLAu').prepend('神速Down'); } else { $('.wp-s-agile-tool-bar__header.is-header-tool').prepend('
'); } if (self == top) { $('body').append(`
加载中
`); } var html = `

当前文件

扫一扫不失联

发送 免费白嫖

四个字获取暗号/无套路

IDM

选项 ->下载->手动添加任务时使用的用户代理(UA) ->填入 LogStatistic。在IDM新建任务,粘贴饪接即可下载,


Aria2/Motrix

点击 推送到 Aria2(Motrix)将自动下载,支持Windows/MAC客户端需要需要设置保存路径。

开发中...

开发中...

`; $('#downbtn1').click(function () { Swal.fire({ title: '系统提示', text: '请先保存到网盘后使用', icon: 'error' }); return; }) $('#downbtn').click(function () { var newStyle = document.createElement('style'); newStyle.textContent = ` .swal2-container { z-index: 9999999999 !important; } `; setTimeout(function () { if ($('.layui-layer-close2').length > 0) { $('.layui-layer-close2').html(''); } }, 666); document.head.appendChild(newStyle); var htmlString = $("html").html(); var regex = /"bdstoken":"(\w+)"/; var match = regex.exec(htmlString); var bdstoken = match[1]; var selectedIds = []; var downlist = []; const selectedItems = getSelectedList() console.log(selectedItems, 222222222) selectedItems.forEach(function (item) { console.log(item) selectedIds.push(item.fs_id); }); // $('tr.selected').each(function () { // var dataId = $(this).data('id'); // selectedIds.push(dataId); // }); console.log('选择了', selectedIds) // $('.mouse-choose-box .is-checked').each(function () { // let dataId = $(this).data('id'); // if (dataId) { // selectedIds.push(dataId); // } // }); if (selectedIds.length === 0) { Swal.fire({ showConfirmButton: true, // 显示确认按钮 // showCloseButton: true, // 隐藏关闭按钮 title: '系统提示', text: '请选择需要下载的文件', icon: 'error' }); return; } if (selectedIds.length > 1) { Swal.fire({ showConfirmButton: true, // 显示确认按钮 // showCloseButton: true, // 隐藏关闭按钮 title: '系统提示', text: '同时只能下载一个文件', icon: 'error' }); return; } if (selectedItems.some(item => !!item.isdir) || $('tr.selected img[src*="ceH8M5EZYnGhnBKRceGqmaZXPPw2xbO+1x"]').length > 0) { Swal.fire({ title: '系统提示', text: '请不要选择文件夹解析,因为还没学会.', icon: 'error' }); return; } var index = layer.open({ type: 1, closeBtn: 2, title: '', shadeClose: true, area: ['850px', '600px'], content: html, success: function (index) { $('#loadingtext').text(''); password = ''; UA = 'netpan'; new PincodeInput('.pincode-input-container', { count: 4, secure: false, previewDuration: 200, onInput: (value) => { console.log(value) if (value.length == 4) { $('.demo').hide(); layer.load(2, { shade: [0.3, '#FFF'], }); $('#loadingtext').show(); download_function(value); } } }) $('#jsonrpc').val(localStorage['jsonrpc']); element.init(); var selectedone = []; $('tr.selected').each(function (index, item) { selectedone.push($(item).find('td').eq(1).find('a').attr('title')); }); if (selectedone.length == 0) { selectedone = getSelectedList().map(e => e.formatName || e.server_filename) } selectedone = selectedone.map(e => e.replace('.PanD', '')) var text = (selectedone + '等' + $('tr.selected').length + '个文件...'); $('#curname').text(selectedone.join('、')); $('#deal').click(function () { layer.load(2, { shade: [0.3, '#FFF'], }) $('#loadingtext').show(); download_function(); }); $('#copy').click(function () { if (!$(this).hasClass('layui-btn-disabled')) { const el = document.createElement('textarea'); el.value = $(this).attr('data-url'); document.body.appendChild(el); el.select(); document.execCommand('copy'); document.body.removeChild(el); layer.msg('已复制,用户代理(UA)-> 填入 LogStatistic'); } }); $('#pusharia').click(function () { if (!$(this).hasClass('layui-btn-disabled')) { var url = $(this).attr('data-url'); sendAria2(url); } }); $('#savejsonrpc').click(function () { localStorage['jsonrpc'] = $('#jsonrpc').val(); layer.msg('已保存'); }); $('#setoption').click(function () { $('#popup').toggle(); }); $('#dialogAriaConfigClick').click(function () { $('#dialogAriaConfig').toggle(); }); } }); layer.style(index, { //background: '#4caf50', }); }); }); function saveLastUseData() { localStorage.setItem('savePath', $("#dialogTxtSavePath").val()); localStorage.setItem('jsonRpc', $("#dialogAriaRPC").val()); localStorage.setItem('token', $("#dialogAriaToken").val()); let mine = ""; if ($("#dialogAriaMine").prop("checked") == true) { mine = "checked"; } localStorage.setItem('mine', mine); } function sendAria2(url) { layer.load(2, { shade: [0.3, '#FFF'], }) let rpcDir = ($("#dialogTxtSavePath").val()).replace(/\\/g, '/'); let rpcHostUrl = $("#dialogAriaRPC").val(); let rpcToken = $("#dialogAriaToken").val(); var ddconfig = { "id": "shensuDown", "jsonrpc": "2.0", "method": "aria2.addUri", "params": [ [ url ], { "max-connection-per-server": 16, "dir": rpcDir, "out": $('#curname').text(), "user-agent": "LogStatistic" } ] } let data = JSON.stringify(ddconfig); //发送至aria2 let details = { method: 'POST', responseType: 'json', timeout: 5000, // 3秒超时 url: rpcHostUrl, data: data, onload: function (res) { if (res.status === 200) { layer.closeAll('loading'); $('#loadingtext').hide(); if (res.response.result) { // 正常返回 Swal.fire({ title: '系统提示', text: '推送成功!快去看看吧', icon: 'success' }); } else { // 其它错误 Swal.fire({ title: '系统提示', text: '发生错误,请关闭窗口重试1', icon: 'error' }); } } else { Swal.fire({ title: '系统提示', text: '发生错误,请关闭窗口重试2' + res.responseText, icon: 'error' }); } }, ontimeout: (res) => { layer.closeAll('loading'); $('#loadingtext').hide(); Swal.fire({ title: '系统提示', text: '连接到RPC服务器超时:请检查推送前Aria2是否正在运行, RPC已连接? RPC配置是否正确!', icon: 'error' }); }, onerror: (res) => { layer.closeAll('loading'); $('#loadingtext').hide(); Swal.fire({ title: '系统提示', text: '发送至Aria2时发生错误,请重试!推送前检查Aria2是否正在运行,RPC已连接? RPC配置是否正确!' + res.responseText, icon: 'error' }); } }; try { GM_xmlhttpRequest(details); } catch (error) { layer.closeAll('loading'); $('#loadingtext').hide(); Swal.fire({ title: '系统提示', text: '发生错误,请关闭窗口重试!', icon: 'error' }); } } function sendMotrix(url) { var jsonrpcData = { jsonrpc: '2.0', id: '1', method: 'aria2.addUri', params: [ [url], { "header": ["User-Agent: " + UA] } ] }; $.ajax({ url: 'http://localhost:16800/jsonrpc', type: 'POST', data: JSON.stringify(jsonrpcData), contentType: 'application/json', success: function (response) { Swal.fire('发送Motrix成功', '请检查你的下载任务', 'success'); }, error: function (error) { Swal.fire('发送错误!', '你可能没有安装或运行下载器!如果已经安装并运行,请尝试重启它,或者检查有没有开启RPC对应端口是否正确,默认Motrix端口为:16800', 'error'); return; } }); } function getSelectedList() { try { return require('system-core:context/context.js').instanceForSystem.list.getSelected(); } catch (e) { return document.querySelector('.wp-s-core-pan').__vue__.selectedList; } } // var getSelectedList = function () { // let pType = getCurType(); // // if (pType === 'old') { // return require('system-core:context/context.js').instanceForSystem.list.getSelected(); // } // if (pType === 'new') { // let mainList = document.querySelector('.nd-main-list'); // if (!mainList) mainList = document.querySelector('.nd-new-main-list'); // return mainList.__vue__.selectedList; // } // } var getCurType = function () {//获取页面新旧 if (isOPage()) return 'old'; if (isNPage()) return 'new'; if (isSharePage()) return 'share'; return ''; } var isOPage = function () { if (document.location.href.indexOf(".baidu.com/disk/home") > 0) { return true; } return false; }; var isNPage = function () { if (document.location.href.indexOf(".baidu.com/disk/main") > 0) { return true; } return false; }; var isSharePage = function () { let pathurl = document.location.pathname.replace('/disk/', ''); if (/^\/(s|share)\//.test(pathurl)) { return true; } return false; } function download_function(password = 'zzzz') { $('#loadingtext').text(''); //password = anhao||password; saveLastUseData(); $('#loadingtext').text('正在分享文件...'); if (!$('#copy').hasClass('layui-btn-disabled')) { $('#copy').addClass('layui-btn-disabled'); } if (!$('#pusharia').hasClass('layui-btn-disabled')) { $('#pusharia').addClass('layui-btn-disabled'); } var htmlString = $("html").html(); var regex = /"bdstoken":"(\w+)"/; var match = regex.exec(htmlString); var bdstoken = match[1]; var selectedIds = []; var downlist = []; var filelists = getSelectedList(); console.log('filelists------->>>>', filelists) for (var i = 0; i < filelists.length; i++) { selectedIds.push(filelists[i].fs_id); } //SubStrString(theFile.server_filename, 35) /*$('tr.selected').each(function () { var dataId = $(this).data('id'); selectedIds.push(dataId); }); $('.mouse-choose-box .is-checked').each(function() { let dataId = $(this).data('id'); if (dataId) { selectedIds.push(dataId); } });*/ console.log('selectedIds------->>>>', selectedIds) $.post("https://pan.baidu.com/share/set?channel=chunlei&bdstoken=" + bdstoken + "", "period=1&pwd=" + password + "&eflag_disable=true&channel_list=%5B%5D&schannel=4&fid_list=[" + selectedIds + "]", function (res) { if (res.show_msg == "该文件禁止分享") { layer.closeAll('loading'); $('#loadingtext').hide(); $('#texttip').val('违规文件,不能进行下载'); Swal.fire("错误!", "所选择的文件中包含违规文件,不能进行下载", "error"); return; } var url = res.link; console.log(res, password) //siteUrl +/parse/listpost surl=百度地址1&pwd=百度密码&password=站点密码 var shorturl = ''; try { shorturl = url.substring(url.lastIndexOf('/') + 1); } catch (e) { console.log(e) } if (!shorturl) { layer.closeAll('loading'); $('#loadingtext').hide(); Swal.fire("错误!", res.msg, "error"); return; } $('#loadingtext').text('正在查询服务器接口地址......'); GM_xmlhttpRequest({ method: "post", url: siteUrl + '/parse/list', data: "surl=" + shorturl + "&pwd=" + password + "&password=" + password + "", headers: { "Content-Type": "application/x-www-form-urlencoded" }, onload: function (response) { //clearTimeout(timeoutId); if (response.status == 200) { const getres = JSON.parse(response.responseText); console.log('getres------->', getres); if (getres.error == -1 || getres.error == 1) { //系统维护 layer.closeAll('loading'); $('#loadingtext').hide(); $('#texttip').val('系统维护中...'); Swal.fire({ title: '系统提示', text: getres.msg, icon: 'error' }); } else if (getres.error == 101) { layer.closeAll('loading'); $('#loadingtext').hide(); $('#texttip').val(getres.err); //暗号错误(或已更新),请重新获取xxxxxxxx const options = { title: '系统提示', showConfirmButton: false, // 隐藏确认按钮 // showCloseButton: true, //关闭按钮 icon: 'error' } if (getres.err.indexOf('暗号错误') > -1) { options.html = '
' + getres.err + '
'; let errmsg setTimeout(function () { let democ = document.querySelector('.pincode-input-container') let inputs2 = document.querySelectorAll('.pincode-input') let clonedemo = document.querySelector('.demo').cloneNode(true); democ.style.display = 'none' let inputs = clonedemo.querySelectorAll('.pincode-input'); clonedemo.querySelector('.pincode-input-container').style.display = 'block' for (let i = 0; i < inputs2.length; i++) { let input = inputs[i]; let input2 = inputs2[i] let next = inputs[i + 1] input.addEventListener('input', function (evt) { input.value = evt.data input2.value = input.value; if (next) { next.focus(); } else { let event = new Event('input'); input2.dispatchEvent(event); // for (let i = 0; i < inputs.length; i++) { // // inputs2[i].value = ''; // // inputs[i].value = ''; // } document.querySelector('.swal2-close').click() } }); } document.querySelector('mydiv').appendChild(clonedemo) }, 0); } else { options.text = getres.err; } Swal.fire(options); $('.demo').show(); } else if (getres.error == 1012) { //系统维护 layer.closeAll('loading'); $('#loadingtext').hide(); $('#texttip').val('系统维护中...'); Swal.fire({ title: '系统提示', text: getres.err, icon: 'error' }); } else if (getres.error == 1011) { //系统维护 layer.closeAll('loading'); $('#loadingtext').hide(); $('#texttip').val('系统维护中...'); Swal.fire({ title: '系统提示', text: getres.err, icon: 'error' }); } else if (getres.error == 0) { // $('#loadingtext').text('正在查询服务器接口地址......'); var data_ = getres.dirdata var data__ = getres.filedata[0] GM_xmlhttpRequest({ method: "POST", url: siteUrl + "/parse/link", data: "fs_id=" + data__.fs_id + "×tamp=" + data_.timestamp + "&sign=" + data_.sign + "&randsk=" + data_.randsk + "&shareid=" + data_.shareid + "&surl=" + data_.surl + "&pwd=" + data_.pwd + "&uk=" + data_.uk, responseType: 'json', headers: { "Content-Type": "application/x-www-form-urlencoded" }, onload: function (ress) { layer.closeAll('loading'); $('#loadingtext').hide(); console.log('ress------->>>', ress) if (ress.response.error == 0) { let downlink = ress.response.directlink; $('#texttip').val('解析成功'); Swal.fire('解析成功', 'IDM下载务必设置好(UA) ->填入 Logstatistic 否则下载报错404,推送aria时需要提前启动软件检查RPC地址是否正确!', 'success'); $('#copy').removeClass('layui-btn-disabled').attr('data-url', downlink); $('#pusharia').removeClass('layui-btn-disabled').attr('data-url', downlink); } else { Swal.fire({ title: '系统提示', text: ress.response.msg + '111111', icon: 'error' }); } } }); } else { throw res; } } } }) }) } // 密码框 ; var PincodeInput = function () { return function () { function b(c, p) { var o = p.count, e = void 0 === o ? 4 : o, i = p.secure, n = void 0 !== i && i, l = p.previewDuration, a = void 0 === l ? 200 : l; this.args = p, this.selector = document.querySelector(c), this.count = e, this.secure = n, this.previewDuration = a, this.cells = [], this.focusedCellIdx = 0, this.value = "", this.setCells() } return b.prototype.setCells = function () { for (var a = 0; a < this.count; a++) { var d = document.createElement("input"); d.classList.add("pincode-input"), this.cells.push(d), this.selector.appendChild(d) } this.initCells() }, b.prototype.initCells = function () { var a = this; this.cells.forEach((function (f, e) { f.addEventListener("input", (function (d) { var c = d.currentTarget.value; a.onCellChanged(e, c, d) })), f.addEventListener("focus", (function () { a.focusedCellIdx = e })), f.addEventListener("keydown", (function (c) { a.onKeyDown(c, e), "ArrowLeft" !== c.key && "ArrowRight" !== c.key && "ArrowUp" !== c.key && "ArrowDown" !== c.key && "Backspace" !== c.key && "Delete" !== c.key && a.cells[e].setAttribute("type", "text") })), f.addEventListener("focus", (function () { f.classList.add("pincode-input--focused") })), f.addEventListener("blur", (function () { f.classList.remove("pincode-input--focused") })) })) }, b.prototype.onCellChanged = function (a, h, g) { var e = this; if (!this.isTheCellValid(h)) { return this.cells[a].classList.remove("pincode-input--filled"), this.cells[a].value = "", void this.getValue() } this.cells[a].classList.add("pincode-input--filled"), this.secure && this.previewDuration && setTimeout((function () { e.cells[a].setAttribute("type", "password") }), this.previewDuration), this.getValue(), this.focusNextCell() }, b.prototype.onKeyDown = function (a, d) { switch (a.key) { case "ArrowLeft": this.focusPreviousCell(); break; case "ArrowRight": this.focusNextCell(); break; case "Backspace": this.cells[d].value.length || this.onCellErase(d, a) } }, b.prototype.onCellErase = function (a, d) { this.cells[a].value.length || (this.focusPreviousCell(), d.preventDefault()) }, b.prototype.focusPreviousCell = function () { this.focusedCellIdx && this.focusCellByIndex(this.focusedCellIdx - 1) }, b.prototype.focusNextCell = function () { this.focusedCellIdx !== this.cells.length - 1 && this.focusCellByIndex(this.focusedCellIdx + 1) }, b.prototype.focusCellByIndex = function (a) { void 0 === a && (a = 0); var d = this.cells[a]; d.focus(), d.select(), this.focusedCellIdx = a }, b.prototype.isTheCellValid = function (a) { return !!a.match("^\\d{1}$") }, b.prototype.getValue = function () { var a = this; this.value = "", this.cells.forEach((function (d) { a.value += d.value })), this.args.onInput(this.value) }, b }() }(); });