Help finding missing images?

I am a new user of DEVONagent, which I bought after running some tests because I find myself doing browser scripting all the time, and an excellent Applescriptable browser environment seems like something I can put to good use.

Right off the bat, I have a question. I did some housecleaning, removing about 100,000 images form my Amazon S3 server because it costs money to keep the files there, even though most of them are old. Now I’m trying to go through my blog and find only the files that need to be uploaded. I like the idea of the “get all links” commands of DEVONagent, but offhand I can’t see anything about how to find only images that are broken. Can anyone help me out with a script or other suggestion that finds the URLs of broken images only on a loaded page (or site URL)? Nope that I only need broken img tags, for some reason all the tools that exist want to find broken links without doing much for broken images.

Thankd for any suggestions you can offer!

After loading a web page you could run this script returning all missing/incomplete images:


tell application "DEVONagent"
	set theWindow to browser 1
	set theImages to {}
	set cnt to (do JavaScript "document.images.length" in theWindow) as integer
	set i to 0
	repeat while i < cnt
		if (do JavaScript "document.images[" & (i as string) & "].complete" in theWindow) is not "true" then
			set theImages to theImages & (do JavaScript "document.images[" & (i as string) & "].src" in theWindow)
		end if
		set i to i + 1
	end repeat
	return theImages
end tell

See also viewtopic.php?f=10&t=13179