HonestlyDex

sellDupeBlooks

Dec 6th, 2021 (edited)
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. async function getName() {
  2.     const response = await fetch('https://api.blooket.com/api/users/verify-token', {
  3.         method: "GET",
  4.         headers: {
  5.             "accept": "application/json, text/plain, */*",
  6.             "accept-language": "en-US,en;q=0.9,ru;q=0.8",
  7.         },
  8.         credentials: "include"
  9.     });
  10.     const data = await response.json();
  11.  
  12.     return data.name;
  13. };
  14.  
  15.  
  16. async function getBlooks(blooketName) {
  17.     const response = await fetch('https://api.blooket.com/api/users/blooks?name=' + blooketName, {
  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.     });
  24.     const data = await response.json();
  25.  
  26.     return data;
  27. };
  28.  
  29. async function sellDupeBlooks() {
  30.     const blooks = await getBlooks(await getName());
  31.     const x = Object.entries(blooks).filter(i => i[1] > 1).map(i => [i[0], i[1] - 1]);
  32.  
  33.     for (const [blook, val] of x) {
  34.         await fetch('https://api.blooket.com/api/users/sellblook', {
  35.             method: "PUT",
  36.             headers: {
  37.                 "referer": "https://www.blooket.com/",
  38.                 "content-type": "application/json",
  39.             },
  40.             credentials: "include",
  41.             body: JSON.stringify({
  42.                 blook: blook,
  43.                 name: await getName(),
  44.                 numSold: val
  45.             }),
  46.         });
  47.     }
  48.  
  49.     if (x.length > 0) {
  50.         alert('Results:\n' + x.map(x => `    ${x[1]} ${x[0]}`).join('\n'));
  51.     } else {
  52.         alert("No duplicate Blooks found.");
  53.     };
  54.  
  55. };
  56.  
  57. sellDupeBlooks();
Add Comment
Please, Sign In to add comment