Skip to content

Instantly share code, notes, and snippets.

@philipjewell
Last active March 29, 2023 00:23
Show Gist options
  • 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.

@FoxMcFluff
Copy link

FoxMcFluff commented May 8, 2020

Hey guys..I don't know if this is still relevant or not. BUT you can download ALL of your photos from greedy photobucket with just JDownloader. I just downloaded all 446 of my old photos from there. Long explanation to follow Of course you still have to use the "Select All" on the page for each album. Once you have all the pictures selected that you want (haven't tried videos, but I assume it will work the same way), open Jdownloader ( Which is now JDownloader 2, and make sure it is listening for copied urls from clipboard ), When it opens, go up to "Settings", click settings, then the "General" Tab. Make sure to set that to the directory that you want your pictures to go to. Next, scroll down to "Packagizer". Untick the box that says "Predefined rule: Create subfolder by packagename". This will allow the pictures to be downloaded straight away into the folder you chose previously. Ok, last step. Back to Photobucket (And make sure all the photos or number of photos you want are reflected down at the bottom of the page.) Then click "Link". A box pops up asking where to copy links. Click in the "Direct" box. Watch as jdownloader pops up populating every picture file you selected. Let it completely populate depending on your connection speed. The "Packages" Tab has a counter down at the bottom left telling you how many have been populated into the download list. Once all are populated, click download and watch your precious memories get ripped away from photobucket's greedy servers. (I should also note that you might want to set the "Max Simultaneous Downloads" in "Settings" to just 1 at a time. and maybe chunk size to 8. Good luck and hope my bored tinkering helped someone. Holds out hand "That will be one cup of coffee" lol

@pmad6
Copy link

pmad6 commented May 25, 2020

@FoxMcFluff - you sir, are a fucking rock star. Thank you.

@raindog1108
Copy link

Downloaded all my photos by the phone method, and kissed of PB forever. Free at last, free at last, thank God almighty, I'm free at last!

Signing off the thread...

@sam576
Copy link

sam576 commented Jun 20, 2020

June 2020: all the tutorials from here and github is no use because you have to upgrade to copy the direct links.

But something weird has happened. I just downloaded all my albums with a single download button. I now have a .zip file of everything. So after cursing Photobucket for not allowing me to copy the direct links, this is what I did:

  1. Updated the app on my phone
  2. Logged on
  3. Panicked bec the photos won’t show up
  4. Went to the site using my laptop
  5. Site automatically changed to app.photobucket.com
  6. Selected all my albums then clicked the download button at the top.

Maybe you just need to access the app website (app.photobucket.com) using your laptop, PC, or even your phone? Worked for me 😊

P.S. if this worked for you, can u please donate to my Paypal account sunres3656@gmail.com. This pandemic has been a huge downfall for incoming students like me 😭 Even 1$ would be a huge help. Thanks 😊

@FoxMcFluff
Copy link

FoxMcFluff commented Jun 20, 2020 via email

@folkmoss
Copy link

folkmoss commented Jul 4, 2020

@sam576: It didn't even open the app website on Firefox, I had to try Microsoft Edge (I don't have Chrome installed atm). But it didn't work for me. It just says "download failed". I tried selecting only one folder at a time, same problem.

EDIT: Alright, now it has worked but only with a handful of pics. I guess the website is still loading them, very, very slowly? Weird. I'll see if more photos show up.

@ach206
Copy link

ach206 commented Jul 5, 2020

Worked great for me. Granted, direct link requires upgrade so obviously I wasn't trying to do that. So I opted for the Email & IM option inside. I copied all the HTML links into the photobucket_files.txt then used regex to get them in the direct link format I needed.
P.S. if you don't know what your direct link format is supposed to look like just use developer tools to inspect the HTML on a given photo - that <img src=""> will have the direct link.
image

@driver-n
Copy link

driver-n commented Jul 24, 2020

Worked great for me. Granted, direct link requires upgrade so obviously I wasn't trying to do that. So I opted for the Email & IM option inside. I copied all the HTML links into the photobucket_files.txt then used regex to get them in the direct link format I needed.
P.S. if you don't know what your direct link format is supposed to look like just use developer tools to inspect the HTML on a given photo - that <img src=""> will have the direct link.

Yeah, took me a while to figure out the email & im links needed to be reformatted into direct links to the image, after that the commands worked.

@rabensm
Copy link

rabensm commented Jul 26, 2020

Sadly, now all the link fields give this:
image

@20031023
Copy link

Worked great for me. Granted, direct link requires upgrade so obviously I wasn't trying to do that. So I opted for the Email & IM option inside. I copied all the HTML links into the photobucket_files.txt then used regex to get them in the direct link format I needed.
P.S. if you don't know what your direct link format is supposed to look like just use developer tools to inspect the HTML on a given photo - that <img src=""> will have the direct link.
image

@ach206 would you be able to share the regex you used to extract the image file name from each .html link and attaching them to your direct links? I know the format of my direct links but I am struggling with the regex.

@techrivertree
Copy link

techrivertree commented Aug 5, 2020

I followed the directions but I got the following errors, can someone explain the errors for me?

fuck photobucket

@robo703
Copy link

robo703 commented Aug 5, 2020

https://gist.github.com/philipjewell/a9e1eae2d999a2529a08c15b06deb13d#gistcomment-3404796

What I did was login through the mobile app through my computer (I saw it on another post here). When you login through the mobile app on your computer you can download entire albums at once. I had thousands of pictures I was able to download quickly using the mobile app on the computer. I think this is the website for the mobile app https://photobucket.com/mobile

Good luck!

@techrivertree
Copy link

I am logged into the mobile app on my phone but how to do I download my albums?

@robo703
Copy link

robo703 commented Aug 6, 2020

You have to do it from your computer. When you login through the mobile app on your computer you can download your pictures. I think this is the website for the mobile app https://photobucket.com/mobile. Use that website while you are on your computer.

@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