Last active
February 18, 2022 07:36
-
-
Save piouc/f408fada5121ca362392f1625c7a8509 to your computer and use it in GitHub Desktop.
illust-ac-download-all-search-result.js
This file contains hidden or 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
(async (from) => { | |
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) | |
const modalLinks = Array.from(document.querySelectorAll('a.link-to-detail')) | |
const fromIndex = modalLinks.findIndex(a => a.dataset.id === from.toString()) ?? 0 | |
for(const a of modalLinks.slice(fromIndex)){ | |
const id = a.dataset.id | |
a.click() | |
let link | |
while(!link){ | |
await wait(250) | |
const dlLink = document.querySelector('.btn-download[data-type-dl=ai]') | |
if(dlLink?.href?.includes(`qu_n=${id}&`)){ | |
link = dlLink | |
} | |
} | |
link.click() | |
await wait(5000) | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment