Google Plus相册网址 [英] Google Plus Album Urls

查看:107
本文介绍了Google Plus相册网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用谷歌应用程序引擎为我拍摄的所有照片创建照片库网站。我想要显示的照片位于我的Google plus帐户中的公开相册中。我希望我的应用自动显示该相册中的所有照片。我知道我可以将所有网址存储到数据存储中的图像,然后将网址传递给模板并渲染图像。

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

#模板
{%图像中的img%}
< img src = {{img}}>
{%endfor%}

我想知道是否有办法让所有自动添加谷歌加相册中的图片,而无需每次手动输入网址。我曾考虑过使用 google plus api ,但我只需要从一个公开相册中获取图片并且不需要访问用户帐户。



有没有一种方法可以检索所有图片或指向公开Goog​​le相册中图片的链接?

解决方案

您可以做到这一点,但答案很有趣,因为它不是通过Google+本身完成的。 b
$ b

The Trick:



要列出Google+相册中的所有照片,请使用Picasa网络相册数据API。这不是显而易见的,这是应该做的,但我写这所有的Google+照片都是Picasa照片。



Picasa的相关文档位于列出相册中的照片






答案:



基本上,在

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

其中 UserID albumID 是您的Google+相册。这会给你一些Xml,列出所有的照片。






解释:



从Google+信息页可能不明显如何找到 userID albumID

查找ID的一种方法是在Google+上导航到您想要的相册,然后将该Url中的长整数插入上述样式中。



具体而言,对于JohnMaddogHall的相册Campus Party,Brasil - Second Edition,我们会将Url从

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

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

从这里开始,您可以解析生成的Xml并列出所有照片。标题信息,缩略图等也可用,如果你需要它。图片的Url位于Xml中的 / feed / entry / media:group / media:content 之下。



我假设你知道如何解析和阅读Python中的Xml






泛化:



如果您需要能够列出用户的所有专辑,您可以使用下面样式的Url,并再次用Google +中的数字替换 userID

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


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?

解决方案

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

这篇关于Google Plus相册网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆