Thanks for this work around. How do I set a specific folder for these legacy images?
I decided to go ahead and get things started. I swapped out the API for the one I have on my account. After 185 pages without any activity, this happened:

...and the script stopped.
How did you get the API key ?
I tried to search for it on the site and even tried to register but couldn't see any options for it anywhere on the site.
I tried running the script in OP but it didn't change any of the images although the script completed without any errors.
So I thought of registering on the site and using it's API and then try running the script.