大头猫米 大头猫米
关注数: 190 粉丝数: 2,239 发帖数: 29,241 关注贴吧数: 386
获取当前百度网盘文件名的油猴脚本备忘防丢2025年2月8日 // ==UserScript== // @name 百度网盘文件列表名称提取 // @namespace http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Ftampermonkey.net%2F&urlrefer=9c843543146e9a5cb94f67285d52576f // @version 0.1 // @description 可提取百度网盘文件名称列表 支持一键复制与数量统计 // @author Yanan // @icon http://tieba.baidu.com/mo/q/checkurl?url=https%3A%2F%2Fwww.google.com%2Fs2%2Ffavicons%3Fsz%3D64%26domain%3Dtampermonkey.net&urlrefer=61ce4d814b39ee9c060d71c115eff415 // @grant none // @run-at document-start // @match http://tieba.baidu.com/mo/q/checkurl?url=https%3A%2F%2Fpan.baidu.com%2Fdisk%2Fmain%2A&urlrefer=9ea892943f57f5c777ec429e1a2cf308 // @match http://tieba.baidu.com/mo/q/checkurl?url=https%3A%2F%2Fpan.baidu.com%2Fs%2F%2A&urlrefer=99b6ceec45ecb8f646d29606667675d0 // @license MIT // @downloadURL http://tieba.baidu.com/mo/q/checkurl?url=https%3A%2F%2Fupdate.greasyfork.org%2Fscripts%2F459748%2F%25E7%2599%25BE%25E5%25BA%25A6%25E7%25BD%2591%25E7%259B%2598%25E6%2596%2587%25E4%25BB%25B6%25E5%2588%2597%25E8%25A1%25A8%25E5%2590%258D%25E7%25A7%25B0%25E6%258F%2590%25E5%258F%2596.user.js&urlrefer=06ed19ef651ca38cc2147a33f22348a3 // @updateURL http://tieba.baidu.com/mo/q/checkurl?url=https%3A%2F%2Fupdate.greasyfork.org%2Fscripts%2F459748%2F%25E7%2599%25BE%25E5%25BA%25A6%25E7%25BD%2591%25E7%259B%2598%25E6%2596%2587%25E4%25BB%25B6%25E5%2588%2597%25E8%25A1%25A8%25E5%2590%258D%25E7%25A7%25B0%25E6%258F%2590%25E5%258F%2596.meta.js&urlrefer=676e16e771e43f7ff98ddac3a6d5e312 // ==/UserScript== (function() { 'use strict'; function copyToClip(content, message) { var aux = document.createElement("textarea"); aux.value = content; document.body.appendChild(aux); aux.select(); document.execCommand("copy"); document.body.removeChild(aux); if (message == null) { alert("复制成功"); } else{ alert(message); } } const showResult = (str, list) => { const div = document.createElement('DIV'); div.style.cssText = 'position: fixed; right:0; bottom: 0; height: 60vh; width: 30vw; display:flex; flex-direction: column; background: #fff; border: 2px dashed blue; z-index: 100000;' const textArea = document.createElement('TEXTAREA'); textArea.style.cssText = 'width:100%; flex: 1; font-family: Arial; '; const statics = document.createElement('DIV'); statics.style.cssText = 'display: flex; align-items: center; height: 30px; border-bottom: 1px solid #ccc; flex-shrink:0;'; statics.innerHTML = '共计:' + list.length + '条,请核对!!'; textArea.value = str; const copy = document.createElement('BUTTON'); copy.innerHTML= '复制'; copy.style.cssText = 'position:absolute; right:20px;top:4px;' copy.addEventListener('click', () => { copyToClip(str); }) div.appendChild(statics); div.appendChild(textArea); div.appendChild(copy); document.body.appendChild(div); } // Your code here... const originOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function (_, url) { console.log(url) if (url.includes('api/list') || url.includes('share/list')) { console.log('started to work', url); this.addEventListener("readystatechange", function () { if (this.readyState === 4) { try { const r = typeof this.response === 'string' ? JSON.parse(this.response) : this.response; const listStr = r.list.map(e => e.server_filename).join('\n'); showResult(listStr,r.list); } catch(e) { console.log('插件解析错误',e); } } }); } originOpen.apply(this, arguments); }; })();
1 下一页