Skip to content

Instantly share code, notes, and snippets.

@philipjewell
Last active March 29, 2023 00:23
Show Gist options
  • Star 49 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save philipjewell/a9e1eae2d999a2529a08c15b06deb13d to your computer and use it in GitHub Desktop.
Save philipjewell/a9e1eae2d999a2529a08c15b06deb13d to your computer and use it in GitHub Desktop.
Download all your photobucket images in bulk via CLI

backstory

On Jul 4, 2017 theverge.com posted an article about photobucket (silently) no longer allowing their users to source their images on 3rd party websites for free, thus leaving websites all over the web broken displaying the following image in replace:

Me being one of those individual, I attempted to go into my photobucket account and download my content as I now have my own hosting I am able to store those images on; however, the only ways to bulk download (on desktop) is by downloading albums through their interface. Doing so, gave me the following error message: "Hmmm. Something didn't click. Want to give it another shot? Try again now."

Doing this serveral times, in different browsers (chrome, firefox and safari), after disabling all my addons and extensions (including ad blockers), it still didn't work.

At this point, doing anything on their website would flood my screen with popups and 3+ ads. I swear I haven't seen anything like it since AOL. But I took screenshots of the errors, doing my due diligance and went to create a ticket for their support team to investigate. Only one problem: their ticket creation system's image uploader doesn't work. Interesting considering their whole business model is designed around you being able to upload images to their interface and serve them on the web...

At this point, I am just under the impression everything is broken and this site is just run down hoping it will get fixed soon. But after talking to their support, they pretty much shrugged their shoulders and said "if you don't have the android app, thats the only way to download them" - HENCE why I am writing this how-to on getting all your image!

Requirements

  • Ability to run bash commands
  • Terminal application to run bash on
  • Text editor
  • Patience to collect all the links via the ad cluttered photobucket website

Steps to download your files in bulk

Fun fact: Unlike photobuckets interface, this also works with your video files and gifs.

  1. Navigate to the album or folder you are wanting to download
  2. Check one of the boxes of the images you want to download
  3. A select all option will pop up in the buttons above, click that button - this will select all the images in that album, not just the images on your current page view.
  4. At the bottom of your screen, a menu bar will show up with your selections. WAIT for the number count of selected items to update before moving onto the next step!
  5. Navigate to the next album or folder you want to download and select those images as well. The selection you made from the previous album(s) will continue to accumulate as you continue to move from album to album.
  6. Once you have collected all the items you want to download, click the link option at the menu displayed at the bottom of the screen
  7. Photobucket will populate a box with all the direct links to the content you've selected, once you click on this, it will copy them to your computer's clipboard. NOTE: I had to do this in firefox, because the button to copy the links didn't work in chrome (might have been a popup blocker or something of that nature)
  8. Create a folder on your desktop titled photobucket
  9. Open a text editor you have on your computer (I use sublime which is available for Mac and PC), paste your links into a new blank document and save it on your photobucket folder on your desktop as a txt file type (ie. photobucket_files.txt)
  10. Open up a terminal based application and run the following commands:
cd ~/Desktop/photobucket
cut -d\/ -f 7 photobucket_files.txt | grep "\." | while read file; do grep "${file}$" photobucket_files.txt; done | while read file; do curl -O --referer "http://s.photobucket.com/" ${file}; done
cut -d\/ -f 7 photobucket_files.txt | grep -v "\." |  sort -u | while read dir; do mkdir ${dir}; cd ${dir}; grep "/${dir}/" ../photobucket_files.txt | while read file; do curl -O --referer "http://s.photobucket.com/" ${file}; done; cd -; done

What this does is tricks the request to the image file is coming from photobucket themselves by definining --referer "http://s.photobucket.com/" allowing you to download the file without dealing with the redirect to their upgrade/update image.

According to the time stamps of my commands, it took roughly 8 minutes for all of the content to download (~347M worth of content, over 1300 files).

NOTE: These scripts will create the albums for you on your personal computer; however, it will only create the albums one level deep. So I feel like this is more than enough just to get away from them if you need to download your content and don't want to pay them.

These one-liners aren't the cleanest in regards to code, but this isn't something I have any interest in cleaning up or improving as it completed the job it was intended for with me.

Hope this helps you as it did me.

@drescherjm
Copy link

I downloaded the Email & IM link and did a couple of search and replace options to fix the the link. This involved removing the .html and switch the first part of the link to work - just open one of the files in a browser to get the right prefix

@techrivertree
Copy link

It looks like photobucket redesigned their website. I logged in, selected every folder, then I selected the download button. A few min later I got a prompt for a 200MB download in a zip file. When I looked in the zip file, all of my photos were there in .jpg format.

Now its time to figure out how to delete my photobucket account.

fuck photobucket

@techrivertree
Copy link

techrivertree commented Aug 26, 2020

Photobucket can fuck themselves AGAIN. I asked them to delete my account since there is no option to do that on the new site. They want this from me:

F photobucket AGAIN

@bogbasic
Copy link

bogbasic commented Aug 26, 2020

Yeah, it's gone a bit weird there lately. My images are still served-up on websites, but uploading new ones has been impossible for a few months. The website just says invalid captcha and won't let me in and the android app looks like this:
http://u.cubeupload.com/jbcooper/20200826174940.jpg
Don't look too good does it for a paying customer.
I received a very similar email to yours years ago when I forgot my password so I think its prob a standard thing they send out but they were quite good at sorting it out then!

@Protobikes
Copy link

Protobikes commented Dec 26, 2020

Thanks for all your efforts. I was never able to download a list to work with. At the time I started there was no mass download tool on the site. I was able to do some via a mobile, but it wasn't very reliable. I have spent a lot of time downloading and checking. The results look good enough for my purposes, so I'm done.
I don't know if anyone else found this, but there were duplicates of many of my pictures. They wanted money, claiming I had 50,000 pictures, I reckon I probably only had half that many. Good riddance to them!

@Oujiii
Copy link

Oujiii commented May 25, 2021

Anyone able to run this in 2021? Don't wanna manually download that.

@Tux2
Copy link

Tux2 commented Mar 29, 2023

Referral needs to be changed, here's the edited commands for 2023:

cut -d\/ -f 7 photobucket_files.txt | grep "\." | while read file; do grep "${file}$" photobucket_files.txt; done | while read file; do curl -O --referer "https://hosting.photobucket.com/" ${file}; done
cut -d\/ -f 7 photobucket_files.txt | grep -v "\." |  sort -u | while read dir; do mkdir ${dir}; cd ${dir}; grep "/${dir}/" ../photobucket_files.txt | while read file; do curl -O --referer "https://hosting.photobucket.com/" ${file}; done; cd -; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment