Skip to content

Instantly share code, notes, and snippets.

@leizongmin
Created February 27, 2018 06:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leizongmin/1f2173bbc57b17a9424300408e446c33 to your computer and use it in GitHub Desktop.
Save leizongmin/1f2173bbc57b17a9424300408e446c33 to your computer and use it in GitHub Desktop.
百度网盘BT任务快捷录入
// 从页面获取所有链接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