Baidu cloud network disk batch share independent links, simple and violent!!! No need to download software, directly on the web page!

There are multiple files that need to be shared separately one by one. If manually, it is very tiring and easy to make mistakes. For this reason, the blogger wrote a script for batch sharing links. There are two ways to use it: one is to execute the code directly in the console window , And the second is to use Google Chrome to load extensions.

Method 1 (faster, violent)

  • Visit the web version of Baidu Cloud Disk (Address: https://pan.baidu.com  ) and log in
  • Multiple files you want to share after selecting multiple
  • Press f12, the browser will pop up the debug box, then you copy the following code in, press Enter to execute. After that, there will be multiple batch individual sharing buttons in the upper right corner of the page.

    (function () {let expiration = 0;/*链接的有效期: 0为永久; 7为7天; 1为1天*/let div = document.createElement("div");let html = "<div id='shareWindow' style='position: fixed;z-index: 999;right: 0;'><button id='batchShare'>批量单独分享</button><button id='toggleResult' style=''>显示/关闭结果</button></div><div id='shareResult' style='display: none;position: relative;background-color: wheat;margin: auto;padding-top: .5rem;font-size: 16px;scroll-behavior: auto;text-align: center;max-width: 50%;z-index: 900;' contenteditable='true'>空空</div>";div.innerHTML = html;let result = [];document.getElementsByTagName("body")[0].append(div);document.getElementById("batchShare").onclick = function () {let list = [];result = [];document.querySelectorAll('.vdAfKMb dd.icP4Eo').forEach(function (e, index) {e.classList.remove("icP4Eo");list.push(e.attributes._position.value);});console.log(list);if (!list.length > 0) {alert('请选择要分享的文件');}loop(list);};document.getElementById("toggleResult").onclick = function () {console.log(result);if ("block" === document.getElementById("shareResult").style.display) {document.getElementById("shareResult").style.display = "none";return;}let str = "";for (let k in result) {str += k + ": " + result[k][0] + " ; 提取码:" + result[k][1] + "\r\n";}document.getElementById("shareResult").innerText = str;document.getElementById("shareResult").style.display = "block";};function loop(list) {let n = list.shift();if (!n) {return;}let t = document.querySelector("dd[_position='" + n + "']");triggerEvent(t, "click");document.querySelector("[data-button-id='b41']").click();let i1 = setInterval(function () {let forever = document.querySelector(".choose-list li[value='" + expiration + "']");if (forever) {clearInterval(i1);triggerEvent(forever, "mousedown");document.querySelector("[class='g-button g-button-large g-button-blue-large sbtn create']").click();let i2 = setInterval(function () {let pw = document.querySelector("input.share-password").value;let href = document.querySelector("input.share-url").value;let file = document.querySelector("#share .select-text").innerText.replace("分享文件(夹):", '');if (pw.length > 0 && href.length > 0) {clearInterval(i2);document.querySelector("input.share-url").value = '';document.querySelector("input.share-password").value = '';console.log(file, href, pw);let r = [];result[file] = [href, pw];if (!(list.length > 0)) {document.querySelector("[class='g-button g-button-large g-button-large-gray abtn close']").click();document.querySelector("#toggleResult").click();alert('done');}loop(list);}}, 200);}}, 200);}function triggerEvent(el, eventName) {try {var evt = document.createEvent('Event');evt.initEvent(eventName, true, true);el.dispatchEvent(evt);} catch (e) {console.log(e);}}})();
  • Click the batch individual button (the link is always valid by default, if you want to change it to a short-term, please check the first few lines of code and follow the prompts to change it), then wait for it to complete and do not do other operations.After completion, a list of all results will pop up.

Method 2 (as a Google Chrome extension, just load it in and use it)

  • Open Google Chrome and enter chrome://extensions/enter in the address to visit
  • Download the Google extension below and unzip it. Click to open the developer option in the upper right corner, then click Load the unzipped extension in the upper left corner, and select the folder you just downloaded to load.

  • Visit the web version of Baidu Cloud Disk (Address: https://pan.baidu.com  ) and log in
  • At this time, there will be multiple batch individual sharing buttons in the upper right corner of the page. Press this button after you have selected multiple options you want to share, and then wait for it to complete.

 

  Like it if it's useful~_~

Guess you like

Origin blog.csdn.net/weixin_37281289/article/details/104603910