Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Plus Album Urls

I am using google app engine to create a photo gallery site for all of the photos I have taken. The photos I would like displayed are on my google plus account in a public album. I would like my app to automatically display all of the photos in that album. I know I can store all of the url's to the images in the data store and then pass the url's to the template and render the images,

images = LinksToImages.all()
self.renderTemplate(images)

#  Template
{% for img in images %}
<img src={{img}}>
{% endfor %}

I was wondering if there was a way to get all of the images in a google plus album automatically without manually entering the url's each time. I have thought about using the google plus api but I only need to get images from one public album and do not need to access the users account.

Is there a way I can retrieve all of the images or links to images from a public google plus album?

like image 565
Jake Runzer Avatar asked Mar 03 '13 06:03

Jake Runzer


1 Answers

You can do this, but the answer is kind of a trick, since it's not done through Google+ per se.

The Trick:

To list all of the photos in a Google+ album use the Picasa Web Albums Data API. It's not at obvious that this is what should be done, but as I write this all Google+ Photos are Picasa photos.

The relevant documentation for Picasa is under Listing photos in an album.


The Answer:

Basically, GET a page at

https://picasaweb.google.com/data/feed/api/user/userID/albumid/albumID

where UserID and albumID are the values for your Google+ album. That'll give you back some Xml, listing all the photos.


The Explanation:

It may not be obvious from the Google+ page how to find the userID or albumID.

One method of finding the IDs is to navigate to the album you want on Google+, and plug in the long numbers from that Url into the above style.

Concretely, for John "Maddog" Hall's photo album "Campus Party, Brasil - Second Edition", we'd convert the Url from

https://plus.google.com/photos/115999964287637644901/albums/5659736500890118225

to

 https://picasaweb.google.com/data/feed/api/user/115999964287637644901/albumid/5659736500890118225

From there, you can parse the resulting Xml and list all the photos. Caption info, thumbnails, etc. is also available if you need it. The Urls of the images are under /feed/entry/media:group/media:content in the resulting Xml.

I assume you know how to parse and read the Xml in Python.


The Generalization:

If you needed to be able to list all of the albums for a user, you would use a Url in the style below, again replacing userID by the number from Google+.

https://picasaweb.google.com/data/feed/api/user/userID
like image 97
Ezra Avatar answered Sep 18 '22 16:09

Ezra