您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
获取迅雷云盘的直接下载链接,可利用其他工具下载(如浏览器下载,idman,curl命令行,Xdown,Motrix)
当前为
// ==UserScript== // @name 迅雷云盘获取直链 // @namespace http://tampermonkey.net/ // @version 1.3 // @description 获取迅雷云盘的直接下载链接,可利用其他工具下载(如浏览器下载,idman,curl命令行,Xdown,Motrix) // @author bleu // @icon https://img-vip-ssl.a.88cdn.com/img/xunleiadmin/5fb4b23888a05.png // @supportURL https://gf.qytechs.cn/zh-CN/scripts/431256/feedback // @match https://pan.xunlei.com/* // @grant none // @require https://cdn.bootcdn.net/ajax/libs/limonte-sweetalert2/11.1.0/sweetalert2.all.min.js // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js // @require https://cdn.bootcdn.net/ajax/libs/clipboard.js/2.0.8/clipboard.min.js // ==/UserScript== (function () { 'use strict'; var local_path; const originFetch = fetch; var reqHeaders, filesURL; Object.defineProperty(window, "fetch", { configurable: true, enumerable: true, // writable: true, get() { return (url, options) => { if (url.indexOf('https://api-pan.xunlei.com/drive/v1/files?limit=100&') === 0) { filesURL = url; reqHeaders = options.headers; //console.log(reqHeaders) } return originFetch(url, options) } } }) var arryIndex; var fileArry; var filetxt; var temp_path; var running = { 'runStatus': false, 'successNum': 0, 'failNum': 0, 'exit': false, 'resultNum': 0, } var $BleuButton, $swalHtml; var main = { addCssStyle() { let cssStyle = ` .btn_bleu{width: 250px;font-size: 20px;padding: 10px 25px;cursor: pointer;text-align: center;text-decoration: none;outline: none;color: #fff;background-color: #008CBA;border: none;border-radius: 14px;display:block;margin:12px auto} .btn_bleu:hover{background-color: #008CEA} .btn_bleu:active{background-color: #008CEA;box-shadow: 0 5px #666;transform: translateY(4px)} .bleu_sa_close {width: 30px;height: 30px;font-size: 30px;} .bleu_sa_title {font-size: 30px;} .bleu_sa_container{margin: 20px 0 0;} .bleu_sa_popup {padding: 0 0 0;} .bleu_a{text-decoration: underline;color: #008CBA;font-size: 20px;} .bleu_a:hover{color: #008CEA} .bleu_sa_title_min{font-size: 20px;padding: 0;} .bleu_sa_popup_min{padding: 0 0 0;text-align-last: right;width: fit-content;} `; let style = document.createElement('style'); style.innerHTML = cssStyle; document.querySelector('head').appendChild(style); }, addElements() { $BleuButton = $('<div id="bleu_btn" class="pan-list-menu-item pan-list-menu-item__active"><span>获取直链</span></div>'); let inputValue = localStorage.getItem("local_path") || 'D:\\Downloads'; let $BleuInput = $(`<div style="font-size: 13px;" class="pan-list-menu-item pan-list-menu-item__active">本地路径:<input type="text" id="bleu_inp" style="width: 60px;font-size: 13px;" value="${inputValue}"/></div>`); $('div.pan-list-menu').prepend($BleuInput, $BleuButton); $swalHtml = $(` <div><input type="button" class="btn_bleu" value="迅雷直链.txt"></input></div> <div><input type="button" class="btn_bleu" value="idman下载.txt"></input></div> <div><input type="button" class="btn_bleu" value="curl下载.txt"></input></div> <div><input type="button" class="btn_bleu xdown" value="复制Xdown下载链接"></input></div> <div><input type="button" class="btn_bleu" value="发送任务到Motrix"></input></div> <div><a class="bleu_a" href="https://gf.qytechs.cn/zh-CN/scripts/431256" target="_blank">txt使用说明</a></div> `) }, addButtonEvent() { $BleuButton.on('click', async function () { if (running.runStatus) { alert('正在生成文件中,稍后再试'); return } local_path = $('#bleu_inp').val();; localStorage.setItem("local_path", local_path); main.setInitValue(); await main.getFileSign(); if (running.exit) { running.exit = false; alert('请刷新页面重新尝试!'); return false; } $('li.pan-list-item').each((index, item) => { if (item.getAttribute('class') === 'pan-list-item') { delete(fileArry[0][index]); } }); await main.getAllFiles(fileArry[0]); running.runStatus = false; running.resultNum = running.successNum + running.failNum; swal.fire({ title: `成功${running.successNum}条;失败${running.failNum}条`, html: $swalHtml, width: 400 + 'px', showConfirmButton: false, showCloseButton: true, allowOutsideClick: false, customClass: { title: 'bleu_sa_title', popup: 'bleu_sa_popup', closeButton: 'bleu_sa_close', htmlContainer: 'bleu_sa_container', }, }) $('.btn_bleu').on('click', function (item) { let temp = item.target.defaultValue; main.getCollatedData(temp) }) }) }, setInitValue() { arryIndex = 0; fileArry = []; filetxt = []; temp_path = ''; running.runStatus = true; running.successNum = 0; running.failNum = 0; running.resultNum = 0; }, async getAllFiles(loopArry) { for (let index = 0; index < loopArry.length; index++) { if (loopArry[index]) { if (loopArry[index].kind === 'drive#file') { await main.getDirectLink(loopArry[index].id); } if (loopArry[index].kind === 'drive#folder') { temp_path += `\\${loopArry[index].name}`; await main.getFileSign(loopArry[index]); await main.getAllFiles(fileArry[arryIndex - 1]); } } } temp_path = temp_path.substring(0, temp_path.lastIndexOf('\\')); }, getFileSign(folder) { return new Promise((resolve, reject) => { let runURL; if (folder) { runURL = `https://api-pan.xunlei.com/drive/v1/files?limit=100&parent_id=${folder.id}&filters={"phase":{"eq":"${folder.phase}"},"trashed":{"eq":${folder.trashed}}}&with_audit=true`; runURL = encodeURI(runURL); } else { runURL = filesURL; } fileArry[arryIndex] = []; $.ajax({ type: "get", timeout: 10000, // 超时时间 10 秒 headers: reqHeaders, url: runURL, dataType: "json", success: function (data, textStatus) { data.files.forEach((item) => { let temp = { 'kind': item.kind, 'id': item.id, 'name': item.name, 'phase': item.phase, 'trashed': item.trashed }; fileArry[arryIndex].push(temp); }); arryIndex++; resolve(textStatus); }, error: function (err) { runURL === filesURL ? running.exit = true : running.exit = false; reject(err); } }); }); }, getDirectLink(sign) { return new Promise((resolve, reject) => { $.ajax({ type: "get", timeout: 10000, // 超时时间 10 秒 headers: reqHeaders, url: `https://api-pan.xunlei.com/drive/v1/files/${sign}`, dataType: "json", success: function (data, textStatus) { running.successNum++; let temp = { 'name': data.name, 'link': data.web_content_link, 'path': local_path + temp_path }; filetxt.push(temp); resolve(textStatus); }, error: function (err) { running.failNum++; reject(err); } }); }); }, _downFlie(fnmae, data) { var elementA = document.createElement('a'); elementA.download = fnmae; elementA.style.display = 'none'; var blob = new Blob([data]); elementA.href = URL.createObjectURL(blob); document.body.appendChild(elementA); elementA.click(); document.body.removeChild(elementA); }, async getCollatedData(dataType) { if (running.resultNum === 0) { return; } var swalTitle = '', dataType = dataType.replace('.txt', ''); running.successNum = 0; running.failNum = 0; let nameLinkTxt = ''; filetxt.forEach(async (item, index) => { if (dataType === '迅雷直链') { nameLinkTxt += `${item.name}\n${item.link}\n`; } if (dataType === 'idman下载') { nameLinkTxt += `idman /d "${item.link}" /p "${item.path}" /f "${item.name}" /a&`; } if (dataType === 'curl下载') { nameLinkTxt += `echo 正在下载这个文件:&echo "${item.path}\\${item.name}"&curl -L "${item.link}" -o "${item.path}\\${item.name}"\n\n`; } if (dataType.match('Xdown')) { nameLinkTxt += `aria2c "${item.link}" --dir "${item.path}" --out "${item.name}"\n`; } }); if (dataType.match('Xdown')) { new ClipboardJS('.btn_bleu.xdown', { text: function () { return nameLinkTxt; } }); Swal.fire({ title: '复制链接成功!', position: 'top-end', type: 'success', showConfirmButton: false, timer: 1000, customClass: { title: 'bleu_sa_title_min', popup: 'bleu_sa_popup_min' } }) } else if (dataType.match('Motrix')) { for (let index = 0; index < filetxt.length; index++) { try { await main.sendDataToMotrix(index); } catch (error) { console.log(error); } } running.failNum === 0 ? swalTitle = '导入成功,请到到Motrix查看任务!' : swalTitle = '导入失败,请打开Motrix!'; Swal.fire({ title: swalTitle, position: 'top-end', showConfirmButton: false, timer: 3000, customClass: { title: 'bleu_sa_title_min', popup: 'bleu_sa_popup_min' } }) } else { this._downFlie(`${dataType}${(new Date()).valueOf()}.txt`, nameLinkTxt); } }, sendDataToMotrix(index) { let jsonData = { id: new Date().getTime(), jsonrpc: '2.0', method: 'aria2.addUri', params: ["token:", [filetxt[index].link], { dir: filetxt[index].path, out: filetxt[index].name }] } jsonData = JSON.stringify(jsonData); return new Promise((resolve, reject) => { $.ajax({ type: 'post', url: 'http://localhost:16800/jsonrpc', data: jsonData, dataType: "json", success: function (textStatus) { running.successNum++; resolve(textStatus); }, error: function (err) { running.failNum++; reject(err); } }); }); }, initUI() { let counter = 20; let listener = setInterval(function () { counter--; if (document.querySelector('.pan-list-item')) { clearInterval(listener); main.addElements(); main.addButtonEvent(); } counter === 0 && clearInterval(listener); }, 200); }, } main.addCssStyle(); main.initUI(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址