JSFiddle - React, Tailwind, and code Playground

by frogggeee McFrogggeee

JavaScript

let studio = prompt("what is the ID of the studio? (you can find it in the URL)");
let reps = 0;
let ids = [];
let totalPages = prompt("how many projects do you want to extract?", "100");
totalPages = Math.round((totalPages * 2) / 20);
for (let g = 0; g < totalPages; g++) {
  extract();
}
function extract() {
	fetch('https://cors-anywhere.herokuapp.com/https://api.scratch.mit.edu/studios/' + studio + '/projects')
	 .then(response => response.json())
	 .then(data => {
	  let d = data;
	  for (let i = 0; i < d.length; i++) {
			ids.push(d[i].id);
			i++;
	  }
    reps++;
	  if (reps == totalPages) {
			prompt("Press ctrl + C to copy this data.", ids.length);
	  }
	});
}