Simple ‘hack’

Ever wanted to download all the photos in located in one album on PhotoBucket.com ? If the answer is positive then here is my very own and very simple trick to do it.

All you need is a browser and the little downloader named wget. Linux users most probably have it on their systems, and windows users can get it from here.

Now what this ‘hack’ consists of? Go to the PhotoBucket album you want to download and chose the “View All” to get a page with all the photos. Now view the source of the page and check the last “urlcodeN” where N is the total number of photos. Write down this or keep it in your mind, and paste the following script in your browsers address bar and replace the N with your number of photos.

javascript:var wnd=window.open(“about:blank”); for(var i=0;i<N;i++){ wnd.document.write(document.getElementById(“urlcode”+i).value+”<br>”); }

Now press [Enter] and wait until the script finishes. It can take a few seconds.

What this script will do anyway? First of all it will open a new window with blank contents, and it will write all the “paths” to the photos inside it, each on a new line.

Now that you have all the download paths to the photos, copy and paste the contents into a text file and open a terminal (windows users a command prompt – cmd) navigate to the directory where you saved the file with the list, and execute “wget -i saved_urls.txt” and sit back. This will download all the files. Windows users make sure that you have wget in your path else the command won’t work.

It’s great to create a new directory and place the “saved_urls.txt” inside that, and this way you already organized the photos.

This works 100% all the time, and you can have the photos you wanted almost with no effort.

Enjoy 🙂

The script can be improved to prompt for the number of files, and this way we transformed it into a “bookmarklet” script!

Here is the improved version:

javascript:var n = prompt(‘Enter the number of photos:’,0); if(n != null && n > 0) { var wnd=window.open(“about:blank”); for(var i=0;i<n;i++){ wnd.document.write(document.getElementById(“urlcode”+i).value+”<br>”); }}

You can put the last version in your Firefox “bookmarks” toolbar, and have it just a click away, when you want to get some photos.

We always get what we want, because we can!

Advertisements

About icebreaker

Senior Software Engineer, Open Source Evangelist.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: