Skip to content

Instantly share code, notes, and snippets.

@thesmartcoder123
Created February 7, 2022 19:29
Show Gist options
  • Save thesmartcoder123/163e407c0e0fe0338458b41be456b322 to your computer and use it in GitHub Desktop.
Save thesmartcoder123/163e407c0e0fe0338458b41be456b322 to your computer and use it in GitHub Desktop.
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
(async () => {
const box = prompt('What is the box you would like to open my buddy? (EXAMPLE: Safari)');
const amount = prompt('How many boxes do you want to open?');
const response = await fetch('https://api.blooket.com/api/users/verify-token', { credentials: "include" });
const data = await response.json();
(new Promise(async (res, rej) => {
var blooks = [];
for (let i = 0; i < amount; i++) {
await sleep(100);
fetch('https://api.blooket.com/api/users/unlockblook', {
method: "PUT",
headers: {
"accept": "application/json, text/plain, */*",
"accept-language": "en-US,en;q=0.9,ru;q=0.8",
},
credentials: "include",
body: JSON.stringify({
box: box,
name: data.name,
}),
}).then(r => {
if (r.status == 200) r.json().then(r => blooks.push(r.unlockedBlook));
});
};
res(blooks);
})).then(blooks => {
let count = {};
blooks.forEach((i) => { count[i] = (count[i] || 0) + 1; });
alert(`Results:\n` + Object.entries(count).map((x) => ` ${x[2]} ${x[0]}`).join(`\n`));
});
})();
@blooksak
Copy link

blooksak commented Mar 8, 2022

i still dont know what to do

@Redlava11wastaken
Copy link

bruh

@fsjdakldsjflks
Copy link

const sleep = (ms) => new Promise(r => setTimeout(r, ms));

(async () => {
const box = prompt('What is the box you would like to open my buddy? (EXAMPLE: Safari)');
const amount = prompt('How many boxes do you want to open?');

const response = await fetch('https://api.blooket.com/api/users/verify-token', { credentials: "include" });
const data = await response.json();


(new Promise(async (res, rej) => {
    var blooks = [];

    for (let i = 0; i < amount; i++) {
        await sleep(100);
        fetch('https://api.blooket.com/api/users/unlockblook', {
            method: "PUT",
            headers: {
                "accept": "application/json, text/plain, */*",
                "accept-language": "en-US,en;q=0.9,ru;q=0.8",
            },
            credentials: "include",
            body: JSON.stringify({
                box: box,
                name: data.name,
            }),
        }).then(r => { 
            if (r.status == 200) r.json().then(r => blooks.push(r.unlockedBlook));
        });
    };
    res(blooks);
})).then(blooks => {
    let count = {};

    blooks.forEach((i) => { count[i] = (count[i] || 0) + 1; });
    
    alert(`Results:\n` + Object.entries(count).map((x) => `    ${x[2]} ${x[0]}`).join(`\n`));
});

})();

@greatmonsteravfj
Copy link

gkuqxgfsxertbjwe4qy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment