I have a script that downloads images from Google. However, as you might have experienced yourself, Google sometimes still shows images in its results that are no longer online, resulting in an error page. How can I tell Python not to bother downloading it if it's no longer there?
Right now I simply use urllib.urlretrieve()
, the content of which gets written to image.jpg
. How can I let Python know that it doesn't need to try to download the image if it no longer exists?