formatting

main
Zynh0722 2024-04-02 20:21:55 -07:00
parent 91fe0edfcd
commit 3f374303a4
1 changed files with 20 additions and 20 deletions

View File

@ -12,28 +12,28 @@ async function getPatchHrefs() {
} }
} }
return ( const hrefRequests = [...Array(7).keys()]
await Promise.all( .map((val) => ++val)
[...Array(7).keys()] .map((page) => {
.map((val) => ++val) return (async () => {
.map((page) => { const req = await fetch(getGalleryPageHref(page));
return (async () => { const data = parse(await req.text());
const req = await fetch(getGalleryPageHref(page));
const data = parse(await req.text());
const gallery = data const gallery = data
.getElementsByTagName("div") .getElementsByTagName("div")
.filter((el) => el.classList.contains("hds-gallery-items")) .filter((el) => el.classList.contains("hds-gallery-items"))
.shift(); .shift();
return gallery return gallery
?.getElementsByTagName("a") ?.getElementsByTagName("a")
.map((el) => el.getAttribute("href")) .map((el) => el.getAttribute("href"))
.filter((el) => el) as string[]; .filter((el) => el) as string[];
})(); })();
}), });
)
).flat(); const hrefLists = await Promise.all(hrefRequests);
return hrefLists.flat();
} }
const allPatches = await getPatchHrefs(); const allPatches = await getPatchHrefs();