JSFiddle - React, Tailwind, and code Playground

by frogggeee McFrogggeee

JavaScript

let user = prompt("whos followers do you want to extract?", "samscallion");
let totalPages = prompt("how many of their followers do you want to extract?", "150");
totalPages = Math.round(totalPages / 20);
let peeps = [];
let peps;
let page = prompt("what value would you like to start at?", "0");
page *= 1;
let reps = 0;
for (let g = 0; g < totalPages; g++) {
  extract(page);
  page += 20;
}
function extract(p) {
	fetch('https://cors-anywhere.herokuapp.com/https://api.scratch.mit.edu/users/' + user + '/followers?offset=' + p)
	 .then(response => response.json())
	 .then(data => {
	  peps = data;
	  for (let i = 0; i < peps.length; i++) {
			peeps.push(peps[i].username);
	  }
    reps++;
	  if (reps == totalPages) {
    	let copys = 1;
      let count = 0;
      alert("there are " + Math.floor((peeps.join()).length / 1789) + " things to copy.");
      let Ccopy = "";
      for (let h = 0; h < Math.floor((peeps.join()).length / 1789); h++) {
      	Ccopy = "";
        while (Ccopy.length < 1789) {
        	Ccopy += peeps[count] + ",";
          count++;
        }
				prompt("Press ctrl + C to copy this data. (" + copys + "/" + Math.floor((peeps.join()).length / 1789) + ")", Ccopy);
        copys++;
      }
	  }
	});
}