Is there a way to get a public URL for individual iCloud photos?
There is no way to get the URL from the Photos app that I am aware of. However, you can create a public album (see screenshot) which will then give you an album URL. You could scrape that page for image URLs. Psuedo Xpath to do so: //div[@class="view image-view canvas-image-view"]

(Note that the page is written in such a way that only the photo[s] visible on-screen are present in the HTML code, so your script would need to scroll through the window to scrape all the necessary URLs.)