new release: programmer friendly gallery downloader

adam.zochowskiadam.zochowski Registered Users Posts: 2 Beginner grinner
Hi

Synopsis:
Simple, albeit ugly, console, linux friendly, proxy supporting, passworded gallery downloader


Reason:
All the available downloaders failed me for multiple reasons:
- no support for hidden / password sites
- no proxy support

minor issues:
- no linux support
- no console support

And other libraries out there are geared towards uploading pictures. Not their download ;/


smugmug API used:
login.anonymously
login.withPassword
logout
images.get
images.getInfo


own API:
_getAllImages ( albumId , albumKey , savePath , password = '' )
_downloadImage ( imageUrl , savePath , albumId = '' , password = '' )


_getAllImages
1) uses images.get to get listing of all available images in a gallery
2) for each image, downloads its info with images.getInfo (to get image URL)
2b) tries to save to disk using original filename if available (otherwise, uses smugmug's generated filename)
3) calls _downloadImage for each image

Password can be left out if not needed.


_downloadImage:
download image helps downloading image
You need to pass albumKey if album has a password on it. This is how smugmug expects cookies.


Friendly Recovery:
If any download step fails, the script tries to proceed ignoring failure
image.g
etInfo responses are cached under imageId_imageKey.info.xml files (similar name as smugmug's auto generated filenames)


Usage:

from libSmugMug import smugmug

mySmugMug = smugmug();
#mySmugMug.PROXY_SERVER = '__proxyServer__'
print mySmugMug.login_anonymously()
print mySmugMug._getAllImages( '__albumId__' , '__albumKey__' , '__savePath__' )
print mySmugMug._getAllImages( '__albumId__' , '__albumKey__' , '__savePath__' , '__password__' )
print mySmugMug.logout()


Epilogue:
I had to download 15gb of pictures from friend's password protected, hidden gallery. Without available tools I wrote my own. In retrospect I could have used some other library for backend and just add image downloader on top of it. But then I would not have learned as much, and would not have had as much fun.

Releasing this to the community. You guys rock, and I wanted to ensure that I do contribute.

Kind regards

Adam Żochowski

Comments

  • SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited January 16, 2010
    Would you mind posting some examples of implementation? I'm trying to find a good bulk download solution that can be made to do multiple albums simultaneously and I think yours may fit the bill if I can figure out how to use it.
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited January 17, 2010
    G'day Adam,

    nice, I think this will be pretty useful thumb.gif

    The only suggestion that I might make is to perform logins over https instead http using httplib.HTTPSConnection.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
Sign In or Register to comment.