Looping / Automating API Call and Saving Data

Hi,
I am working with an unofficial TikTok API that sends 30 items per call. In the data there is a parameter called nextCursor which should be included in the next call to get the next set of 30 items. I have a call working to return the first 30 items, but i can’t figure out how to collect the next 30 and the next 30 after that and so on… ultimately i am trying automate the call so that it retrieves items in the 1000s for a research project.

Can anyone help? Thanks