in reply to How can I do this better?
- You accept HTML and GIF, but not JPEG or PNG? Are you really sure that's what you want to do?
- You're sleeping one too many times for failing urls.
- If you take a look at why you're unable to fetch a url, you may discover that it is pointless to try again two times (costing you another 2 x (roundtrip + 5) seconds, with an extra 5 seconds thrown in if you don't fix (2)).