Created
February 15, 2025 03:45
-
-
Save chamlis/20de3d0e62b1c6f1e3fe013179dab49d to your computer and use it in GitHub Desktop.
Script to bulk claim an itch.io bundle (paste in console on bundle page)
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
[...Array(parseInt(document.querySelector("span.pager_label>a").innerText)).keys()] | |
.map(i => i + 1) | |
.reduce((p, i) => p.then(l => fetch(location.origin + location.pathname + "?page=" + i) | |
.then(x => x.text()) | |
.then(x => [...l, new DOMParser().parseFromString(x, "text/html")]), | |
) | |
.then(x => new Promise(f => setTimeout(() => f(x), 2000))), | |
Promise.resolve([])) | |
.then(l => l | |
.flatMap(d => Array.from(d.querySelectorAll("form:has(button[value='claim'])"))) | |
.reduce((p, f) => p | |
.then(_ => fetch("", {body: new URLSearchParams(new FormData(f, f.querySelector("button"))), method: f.method, redirect: "manual"})) | |
.then(_ => new Promise(f => setTimeout(f, 2000))), | |
Promise.resolve(null))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment