Created
February 27, 2018 06:28
-
-
Save leizongmin/1f2173bbc57b17a9424300408e446c33 to your computer and use it in GitHub Desktop.
百度网盘BT任务快捷录入
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 从页面获取所有链接URL | |
// http://www.msj1.com/archives/2868.html | |
console.log( | |
"list=%s", | |
JSON.stringify( | |
Array.from(document.querySelector("#content table").querySelectorAll("tr")) | |
.map(tr => tr.querySelector("td a")) | |
.filter(a => a) | |
.map(a => a.href) | |
) | |
); | |
// 在百度网盘中中执行 | |
(async () => { | |
function sleep(ms) { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, ms); | |
}); | |
} | |
for (const url of list) { | |
document.querySelector(".create-normal-button").click(); | |
await sleep(500); | |
document.querySelector("#share-offline-link").value = url; | |
await sleep(1000); | |
document.querySelector("a[data-button-id=b85]").click(); | |
await sleep(2000); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment