Monday, July 17, 2017

Finding broken Photobucket Images on your site

Hopefully this helps more than a few site admins, bloggers, etc. who are seeing this image (right) instead of their Photobucket photos.

As you may know, Photobucket suddenly decided to break 3rd party image hosting for everyone on earth, rendering images on blogs, forums, and numerous other sites useless (link to story).

If you don't want to pay $399 per year for an account upgrade...

Here is a quick and dirty way to find broken Photobucket images on your site -- if your site isn't too huge. This should work in Linux, Mac or Windows with Cygwin.

wget -l 1 -r --force-html
find . -type f -exec grep -iHl 'photobucket' {} \; > photobucket.txt

The file photobucket.txt will contain a list of URLs for you to look at. For example, on this site, I get this list:

This list of filenames correspond to URLs on the site.
How does it work? 

Use wget to download the webpages recursively (-r) on your site only (one level deep with -l 1). 

Then, find all the files with find and use grep to search for the string photobucket

When that string is found, print the name of the file, only ignoring case (-iHl) and stick the output in a text file.

No comments:

Post a Comment