There’s a script example that loops page results here:
But as Jay said, depending on your goal, using data explorer might be a way better solution if you’re admin.