First working version of the script. Actually downloads images correctly.
Still brittle, and needs to allow for more configuration.