Created
November 2, 2009 19:25
-
-
Save talison/224391 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # | |
| # Downloads the source photos of a Picasa Web Album using the Python gdata API. | |
| # | |
| ##### | |
| import gdata.photos.service | |
| import gdata.media | |
| import gdata.geo | |
| import urllib2 | |
| gd_client = gdata.photos.service.PhotosService() | |
| gd_client.email = 'xxxxxx@gmail.com' | |
| gd_client.password = 'xxxxx' | |
| gd_client.source = 'picasa-get v 0.0.1' | |
| gd_client.ProgrammaticLogin() | |
| # albums = gd_client.GetUserFeed() | |
| # for album in albums.entry: | |
| # print 'title: %s, number of photos: %s, id: %s, name: %s' % (album.title.text, | |
| # album.numphotos.text, album.gphoto_id.text, album.name.text) | |
| album_name = 'MyAlbum' | |
| photos = gd_client.GetFeed('/data/feed/api/user/default/album/%s?kind=photo' % (album_name)) | |
| for photo in photos.entry: | |
| print "Photo: ", photo.title.text, ", url: ", photo.content.src | |
| print "Writing ", photo.title.text | |
| f = open(photo.title.text, 'w') | |
| f.write(urllib2.urlopen(photo.content.src).read()) | |
| f.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment