I used kodakgallery.com in 2004 for some photos. I was younger then. I didn't know that I shouldn't bother storing photos on one of the worst photo hosts on the Internet. I thought Kodak was a brand I could trust.
"WE DON'T WANT TO DELETE YOUR PHOTOS" says the email I got today. Fine, delete them. But only after I download them. And I'm not going to pay you $20 to get an Archive CD either.
They're well within their rights to do so (heck, everyone needs to make some money) -- but they also make it quite difficult to download these photos. If you had 200 photos, you would have to click the "Download Full Resolution" button 200 times individually. If these photos are mine, then shouldn't it be a little easier? Sorry, a product manager in some stovepiped organization said no.
A quick google search returned basically no super-easy way to download and archive these things in one fell swoop.
I thought I'd whip up this simple ruby script to download them to your local directory. It requires the 'mechanize' and Ruby 1.8.6+. Save this code to a file, e.g. "kodak_easyshare.rb", edit your username and password in the script below, then run 'ruby kodak_easyshare.rb' -- and watch the magic happen.
You own those photos. Get them. Download them. Don't let Kodak hold you hostage.
This is hereby released under MIT license.
require 'rubygems'
require 'mechanize'
require 'fileutils'
agent = WWW::Mechanize.new
signin_page = agent.get('http://www.kodakgallery.com/Signin.jsp')
signin_page.forms[0].email = 'yourlogin_at_gmail.com'
signin_page.forms[0].password = 'your_password_here'
signin_page.forms[0].submit
album_page = agent.get('http://www.kodakgallery.com/AlbumMenu.jsp?Upost_signin=Welcome.jsp')
albums = album_page.links.map{|l| (l.href.match(/BrowsePhotos.jsp/) && l.text && l.text.match(/[A-Za-z0-9]/)) ? {:href => l.href, :name => l.text} : nil}.compact
albums.each do |album_hash|
puts "\n\n\n"
puts "-----------------------------------------"
puts "'#{album_hash[:name]}'"
puts "#{album_hash[:href]}"
gallery_page = agent.get("http://www.kodakgallery.com/#{album_hash[:href]}")
photos = gallery_page.links.map{|l| (l.href.match(/PhotoView.jsp/) && !l.href.match(/javascript/)) ? l.href : nil}.compact.uniq
album_dirname = album_hash[:name].gsub(/[\n\t\?\:\>\<\\\/|]/, '_')
unless File.exists?(album_dirname)
puts "creating album #{album_dirname}"
FileUtils.mkdir(album_dirname)
end
FileUtils.cd(album_dirname, :verbose => true) do
photos.each do |p|
photo_page = agent.get("http://www.kodakgallery.com/#{p}")
fullres = photo_page.links.map{|l| (l.href.match(/FullResDownload/) && !l.href.match(/javascript/)) ? l.href : nil}.compact.uniq.first
file_to_dl = "http://www.kodakgallery.com#{fullres}"
result = agent.get(file_to_dl)
if result.class == WWW::Mechanize::File
result.save
puts "Saved #{file_to_dl}"
else
puts "FAIL on #{file_to_dl}"
end
end
end
puts "-----------------------------------------"
puts "-----------------------------------------"
puts "-----------------------------------------"
end