Advertisement
HonestlyDex

spamBoxes

Dec 6th, 2021 (edited)
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const sleep = (ms) => new Promise(r => setTimeout(r, ms));
  2.  
  3. (async () => {
  4.     const box = prompt('What box do you want to open? (EXAMPLE: Space)');
  5.     const amount = prompt('How many boxes do you want to open?');
  6.  
  7.     const response = await fetch('https://api.blooket.com/api/users/verify-token', { credentials: "include" });
  8.     const data = await response.json();
  9.  
  10.  
  11.     (new Promise(async (res, rej) => {
  12.         var blooks = [];
  13.  
  14.         for (let i = 0; i < amount; i++) {
  15.             await sleep(100);
  16.             fetch('https://api.blooket.com/api/users/unlockblook', {
  17.                 method: "PUT",
  18.                 headers: {
  19.                     "accept": "application/json, text/plain, */*",
  20.                     "accept-language": "en-US,en;q=0.9,ru;q=0.8",
  21.                 },
  22.                 credentials: "include",
  23.                 body: JSON.stringify({
  24.                     box: box,
  25.                     name: data.name,
  26.                 }),
  27.             }).then(r => {
  28.                 if (r.status == 200) r.json().then(r => blooks.push(r.unlockedBlook));
  29.             });
  30.         };
  31.         res(blooks);
  32.     })).then(blooks => {
  33.         let count = {};
  34.  
  35.         blooks.forEach((i) => { count[i] = (count[i] || 0) + 1; });
  36.        
  37.         alert(`Results:\n` + Object.entries(count).map((x) => `    ${x[1]} ${x[0]}`).join(`\n`));
  38.     });
  39. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement